PIZZA ALVOLOC

Given four points on the boundary of a convex polygon in the order picked, decide whether segments (1,2) and (3,4) split the pizza into four pieces.

Medium4GeometryInterviewNo attempts yetTime limit1sMemory limit128 MB

Problem

Doyun and three friends celebrate the end of exams at Doyun's place. They get hungry and order a pizza from PIZZA ALVOLOC nearby. Unlike an ordinary pizza, every pizza from this shop is shaped like a convex polygon. The four of them split it this way.

  1. One at a time, in order, each person picks a point on the edge of the pizza. All four picked points are different.
  2. In the order they were picked, draw a segment from the first point to the second point, and a segment from the third point to the fourth point.
  3. Cut the pizza along both segments.

The sizes of the pieces do not matter. If the cuts leave exactly four pieces, the four of them share the pizza peacefully, otherwise they fight over it. In figure 1 the two segments split the pizza into four pieces. In figure 2 the two segments split it into three pieces.

Read the coordinates of the four points and decide whether the pizza ends up in four pieces.

Input

The first line contains the coordinates of the four picked points, in the order they were picked, as x1x_1 y1y_1 x2x_2 y2y_2 x3x_3 y3y_3 x4x_4 y4y_4 separated by spaces. Every coordinate is an integer with 10000xi,yi10000-10000 \le x_i, y_i \le 10000. The four points are distinct and all lie on the boundary of the same convex polygon.

Output

Print 1 if the pizza is cut into exactly four pieces, and 0 otherwise.