eolymp
bolt
Try our new interface for solving problems
Problems

Point and triangle

Point and triangle

Does the point O belongs to the triangle ABC? The point belongs to the triangle if it lies inside it or on its boundary.

Input

Contains the coordinates of the points O, A, B, C. All values are integer, not greater than 100 by absolute value.

Output

Print 1 if the point O belongs to the triangle ABC and 0 otherwise.

Time limit 1 second
Memory limit 128 MiB
Input example #1
1 1 -1 0 2 4 4 1
Output example #1
1
Input example #5
-2 0 7 0 -2 5 0 -5
Output example #5
0