URI Online Judge | 1204

Myachowski, Russian Football

By Cristiane M. Sato Brazil

Timelimit: 1

Many different sources are assigned to football. The oldest activity resembling football was practiced in China between the century. II and III BC and was called ts'uh Kuh (cuju), and was to play a little ball with feet to a network. In Japan there is kemari practiced today in cultural events. In Rome threw up harpastum, and in Greece the epislcyros. With the discovery of the new world was discovered Mayan also a game very similar to football, pok pok ta that have more than 3000 years of history. In the Middle Ages played in Florence the Florentine calcio, They consider many to be the birthplace of modern football. Until today the Amazon Indians play a very similar game in which a ball is pushed using just head toward enemy targets. Anyway, it's almost impossible to say which game gave the football played today, whose rules were formally established by the British in the late nineteenth century.

Little has news of a Russian game, also ancestor of football and with very clear rules (as Arnold would say). It is Myachowski, also known as Otskok. The name probably comes from My÷ (reads myach) which means "ball" in Russian. In the game a player enters a field that is a closed ellipse and must hit a hole located in the wall of the field. But the point is only computed if the ball goes into the hole after being kicked against the walls of the field, being diverted into the hole.

Given the initial position of the ball, the direction in which it is moving and the description of the field, your task is to determine next two points of contact of the ball with the side of the field. Consider that the center of the field is the position (0, 0).

Ball Reflection: Assume for this problem that is reflected perfectly the ball when it hits the wall of the field. That is, the angle of the input vector causes the tangent line to the wall of the field at the point of contact is the same as the departure angle. The Figure 1 illustrates this behavior.

Input angle is the same that output angle


The input consists of several instances and ends with the end of file (EOF). Each instance consists of a row containing six integers, X, Y, Dx, Dy, (-1000 <= Dx,Dy <= 1000), A e B, (1 <= A,B <= 500). The initial position of the ball is given by the point (X, Y) inside the ellipse and the direction vector (Dx, Dy).

The field is shaped like an ellipse described by the equation

x²    y² 
    -  +  -  = 1.
A²    B² 


For each instance print two lines. The first line should contain the first point of contact of the ball with the side of the field and the second line should contain the second point of contact. One point of contact should be printed as two rational numbers separated by a space. Print numbers with exactly 3 decimal places.

Sample Input Sample Output

0 0 1 1 1 1
0 0 1 0 2 3
-30 40 30 7 200 100

0.707 0.707
-0.707 -0.707
2.000 0.000
-2.000 0.000
127.955 76.856
192.310 -27.464