Similar Polygons

No attempts yetTime limit1sMemory limit1024 MB

Problem

Juku is learning about polygon similarity at school. Two polygons are similar if all corresponding angles are equal and all corresponding side lengths are in the same ratio. Similar polygons may be rotated, reflected, and translated relative to one another. The ratio of corresponding side lengths of two similar polygons is called their similarity factor.

For homework Juku receives several pairs of polygons and must decide, for each pair, whether the polygons are similar and, if so, what their similarity factor is. Some polygons have a very large number of vertices, so help Juku finish his homework.

Input

The first line contains the number of polygon vertices $N$ ($3 \le N \le 200,000$). The second line contains $2N$ integers between $-10^9$ and $10^9$: the $x$ and $y$ coordinates of the vertices of the first polygon, in order. The third line likewise contains the $2N$ coordinates of the second polygon's vertices.

The vertices may be given in either clockwise or counterclockwise order. The given points always form a polygon with no coinciding points, no straight ($180°$) angles, and no self-intersections. Moreover, within each polygon all side lengths are distinct.

Output

If the two polygons are similar, print two lines.

  • On the first line print the square of the enlargement factor as a reduced fraction p/q. The enlargement factor is how many times larger the first polygon is than the second (if the first is smaller, it is less than $1$); $p$ and $q$ are positive integers with $\gcd(p,q)=1$, and the denominator is always written, even when it is $1$ (e.g. 2/1). The factor itself may be irrational and thus cannot be compared exactly, so its square — which is always rational — is printed instead (the factor is $k=\sqrt{p/q}$).
  • On the second line print the index of the vertex of the second polygon that corresponds to the first vertex of the first polygon. Vertices of both polygons are numbered from $1$ in the order they appear in the input.

If the polygons are not similar, print $-1$ on a single line.

Because all side lengths within a polygon are distinct (so the polygon has no symmetry), this correspondence is uniquely determined.