High School Programming League 2008/2009

UBoat

Problem code: HS09UBT

A submarine traveling at speed V [m/s] sends a supersonic impulse of frequency F1 [kHz]. The signal bounces off a ship and comes back after time T [s] with frequency F2 [kHz]. Speed of sound in water equals 1450 [m/s]. Calculate the distance between the submarine and the ship in meters.

Input

There is K (1<=K<=30000) lines of standard input. Each consists of four numbers T, V, F1, F2 (1<=T<=3000, 0.1<=V<=20, 20<=F1, F2<=20000) separated by spaces. There T – time of the supersonic impulse in seconds, V – speed of the submarine in meters per second, F1 - frequency of the impulse when sending, F2 – frequency of the impulse when received. All the input values are given with 0.1 accuracy. In the line number K+1 there are four zeros which should not be processed.

Output

Write K lines of output consistent with the input. In each line the distance between the submarine and the ship in meters.

The judge will allow relative error up to 1 percent.

Example

Input:
4 1.5 30 31 5 2.1 35 37 0 0 0 0

Output:
2900 3625

Scoring

For solving this problem you will score 10 points.


Added by:Adam Dzedzej
Date:2010-01-20
Time limit:1s
Source limit:50000B
Languages:SED C99 strict C++ 4.0.0-8 C++ 4.3.2 TCL SCALA NICE NEM BASH PHP SCM guile LISP sbcl LISP clisp ERL TECS TEXT DOC PDF PS PERL 6 JS
Resource:High School Programming League (thanks to Talent Association)
SPOJ System © 2010 Sphere Research Labs. All Rights Reserved.