202. Detective H

Problem Statement:
Detective H is a professional hitman. He can hunt his victim with a single shot of his gun. Today he wants to perform an assassination of Agent R. The assassination is planned to take place in the main point of the town.

Agent R drives his motorcycle at speed S meters per second. He starts riding his motorcycle N meters away from the main point. Detective H is standing M meters away from the main point in a perpendicular street of Agent R's street.

You can consider the location of Agent R as point (N,0), the location of Detective H as point (0,M), the location of the main point as point (0,0).

Detective H's gun shoots a bullet at speed of K meters per second. Now he wonders how many seconds he should wait to shoot his victim so that the bullet reaches his victim at the same time he arrives at the main point. Note that if he shoots too early or too late he'll miss his fast moving victim.

Input Format:
Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 <= T <= 100). Each test case consists of one line with four integers. S the speed of Agent R, N how many meters Agent R is away from the main point, K the speed of Detective H's shot, M how many meters Detective H is away from the main point. (1 <= S,N,K,M <= 10,000).

Output Format:
For each test case, print on a single line, a single number representing the number of seconds Detective H should wait, rounded to five decimal places, or print -1 if it's impossible for Detective H to shoot Agent R (he is moving too fast).

Sample Input:
3 1 1 1 1 2 1 1 1 3 10 7 17

Sample Output:
0.00000 -1 0.90476

 Added by: ahmed_aly Added at: 2014-08-23 14:00:01 UTC Time Limit: 1 second Partial score: No Source: A2OJ FCI-CU Tournament 2014 - Final Round