High School Programming League 2008/2009

Minimal distance

Problem code: HS09MIN

Matt and Filip love to ride a bike. Matt is currently riding west to east at constant speed VM [m/s], and Filip is riding south to north at constant speed VF [m/s]. Both of them started riding at the same time, when Matt was DM [m] before a crossroads and Filip was DF [m] past the same crossroads. Calculate the smallest distance at which Matt and Filip will be from each other during their ride.

Picture

Input

In N(2 ≤ N ≤ 60 000) lines of standard input there are four integer values VM, DM, VF, DF (2 ≤ VM, DM, VF, DF ≤ 100 000 000) separated by spaces. In line N+1 there are four zeros separated by spaces. Do not process this test case.

Output

Write out N lines to standard output. For each test case, write the minimal distance between Matt and Filip in a separate line. Preserve the order of lines from the input. The relative error of your result shouldn't exceed 0.000001

Example

Input:
17 286 34 139
12 130 9 107
31 309 22 74
38 192 26 73
29 50 27 118
0 0 0 0
Output:
317.96887
163.6
239.180354
168.66674
128.156155

Scoring

For solving this problem you will score 10 points.

 

Added by:Adam Dzedzej
Date:2009-10-17
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.