HUNT1 - Dwarven SniperĀ“s Hunting

Now the hunting starts in the world named DOTA, a stupid PC game which cannot play with others together.

Among the individuals in the game, there are two heroes named Dwarven Sniper and Lycanthrope. Lycanthrope wants to escape from being captured; however, our Dwarven Sniper won't let him go! He will use the Silver Bullet to kill the Lycanthrope by only one shot! Yes, that's enough.

Lycanthrope is running on a line in the map with a constant speed. The weapon range of the Silver Bullet is limited by L meters. Dwarven Sniper can run for a while freely, and then shoot Lycanthrope. In order to show his excellent shooting skill, Dwarven Sniper wants the Silver Bullet flying as far as possible. But don't forget the flying time of the Silver Bullet due to considerable weight of the bullet. And Dwarven Sniper wants to stop the hunting as quickly as possible. So if there is more than one way to show his excellent skill, he would choose the fastest way. In this problem we consider the Silver Bullet and Lycanthrope as two points.

Now Dwarven Sniper wants to know the maximum length that the Silver Bullet can fly, and (under this condition) the shortest time that the hunting lasts. Specifically, the total hunting time is defined as the time interval from the start of hunting to the moment that the bullet hit Lycanthrope. Can you help him?

Input

There are several test cases. Each of them contains only one line which consist of 9 real numbers, that are X1, Y1, X2, Y2, Lx, Ly, vD, vB and L (-10000 <= X1, Y1, X2, Y2, Lx, Ly <= 10000, 0 <= vD, vB, L <=100000). The pair (X1, Y1) is the starting position of the Lycanthrope while (X2, Y2) is the starting position of Dwarven Sniper, while (Lx, Ly) is the moving vector per second of the Lycanthrope, vD is the speed of the Dwarven Sniper, vB is the speed of the Silver Bullet, L is the maximum possible flying distance of the bullet.

All units are meters/second.

It is guaranteed that (Lx*Lx+Ly*Ly) < vD*vD < vB*vB , and Dwarven Sniper's starting position is different from Lycanthrope's position. The input ends with a line containing all zeros.

Output

For each test case, output two real numbers S and T in a line separated by a single space denoting that the Silver bullet flies S meters before hitting Lycanthrope and the hunting lasts for T seconds, both with 3 numbers after the decimal point.

You may assume that Dwarven Sniper can finish his hunting within no more than 1e+9 seconds.

Note: The judge is "ignoring extra white spaces".

Example

Input:
-1 0 0 10 1 0 2 10 10
0 0 0 5 0 1 2 6 6
0 0 0 0 0 0 0 0 0

Output:
10.000 1.000
6.000 3.000


Added by:Fudan University Problem Setters
Date:2011-09-08
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:ACM/ICPC Regionals, Shanghai 2011 Preliminary

hide comments
2011-09-15 03:57:26 Amit Chowdhary
Is he allowed to shoot only after he runs for some time? thats the only way it could work. btw thanks for the reply. :)

Re (by XilinX): He wants the bullet flies as far as possible, but no more than L (read the description of L in the input section).

Last edit: 2011-09-15 06:39:13
2011-09-15 01:25:21 Amit Chowdhary
there seems to be something wrong with test case 2; target is at (0,5) and moves at 1 m/s in the y direction, the bullet travels at 6 m/s, if he shoots at t=0; without moving; after 1 second bullet and lycanthorpe will intersect at (0,6)

RE (by XilinX): read the problem statement CAREFULLY.

Last edit: 2011-09-15 02:32:42
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.