0%

Area

For a given polygon g, computes the area of the polygon.

g is represented by a sequence of points $p_1$, $p_2$,…, $p_n$ where line segments connecting pi and pi+1 (1 ≤ in−1) are sides of g. The line segment connecting pn and p1 is also a side of the polygon.

Distance

For given two segments s1 and s2, print the distance between them.

s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.

Cross Point

For given two segments s1 and s2, print the coordinate of the cross point of them.

s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.

Intersection

For given two segments s1 and s2, print “1” if they are intersect, “0” otherwise.

s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.

Parallel/Orthogonal

For given two lines s1 and s2, print “2” if they are parallel, “1” if they are orthogonal, or “0” otherwise.

s1 crosses points p0 and p1, and s2 crosses points p2 and p3.

Counter-Clockwise

For given three points p0,p1,p2, print

if p0,p1,p2 make a counterclockwise turn (1),

if p0,p1,p2 make a clockwise turn (2),

Reflection

For given three points p1,p2,p, find the reflection point x of p onto p1p2.

Input

In the first line, integer coordinates of p1 and p2 are given. Then, q queries are given for integer coordinates of p.

Projection

For given three points p1,p2,p, find the projection point x of p onto p1p2.

Input

In the first line, integer coordinates of p1 and p2 are given. Then, q queries are given for integer coordinates of p.