Vova and Sergey play a game. Vova has the map of Petrozavodsk
on his table, and three strategic points are marked on the map: (x1, y1) is the
Petrozavodsk State University,
(x2, y2) is the Aquatika
Swimming-Pool, and (x3, y3) is the Bowling Center, where Vova and Sergey play table football. These points and the segments that connect them form a nondegenerate triangle. Vova and Sergey play with a triangular chip cut out from a sheet with a problem statement. The goal of the game is to transfer the chip in several moves to the marked triangle, i.e., in the end the vertices of the chip must exactly coincide with the vertices of the triangle. During a move, it is allowed to apply to the chip either a parallel translation or rotation. It is not allowed to turn the chip over. You may assume that during the game the chip always stays within the bounds of the map. Vova has one move left. Can he win with this move?
Input
The first line contains six integers: x1, y1, x2, y2, x3, y3. The second line contains the coordinates of the chip before Vova's last move:
X1, Y1, X2, Y2, X3, Y3.
The absolute values of all numbers in the input do not exceed 2000.
Output
If Vova cannot transfer the chip to the desired position in one move by parallel translation or rotation, then output 0. If he can do it by parallel translation along a vector (dx, dy), then output 1 dx dy. If he cannot do it by parallel translation, but can do it by rotation about a point (x0, y0)
by an angle A degrees couter-clockwise
(0 ≤ A < 360), then output
2 x0 y0 A.
The numbers dx, dy, x0, y0 and A must contain not less than 10 fractional digits.
Sample
input | output |
---|
0 0 10 0 0 -10
0 0 10 0 0 10
| 2 0.0000000000 0.0000000000 270.0000000000
|
Problem Author: Alexander Ipatov
Problem Source: The XIth USU Programing Championship, October 7, 2006