## TAPS - The Water Taps

no tags

There are n taps connected to a water tank. Inlet taps are used to fill the tank and outlet taps are used to empty the tank. You are given the number of hours required for every tap to either fill the tank or empty the tank individually. The tank is initially empty. Find the time (in hours) required to fill the tank if all the taps are opened simultaneously. You can safely assume that it is always possible to fill the tank in a finite number of hours. Your solution's absolute or relative error must be strictly less than 10^-2. (i.e. your solution can make mistakes upto 0.01)

Input:

The first line consists of an integer t, the number of test cases. For each test case, the first line consists of an integer n, the number of taps followed by a line with n non-zero integers. Each value is positive if the tap is used to fill the tank and negative if the tap is used to empty the tank.

Output:

For each test case print the number of hours required to fill the tank completely when all the taps are opened simultaneously.

Input Constraints:

1<=t<=10000

1<=n<=10

-10<=Tap[i]<=10

Tap[i]!=0

Sample Input:

4

2

9 3

5

-5 4 3 -7 6

8

2 10 8 -6 4 -3 -4 2

2

8 -10

Sample Output:

2.250

2.45

1.3793103

40

 Added by: cegprakash Date: 2014-03-09 Time limit: 2s Source limit: 50000B Memory limit: 1536MB Cluster: Cube (Intel G860) Languages: All except: GOSU