Welcome to ZOJ
 Problem Sets Information Select Problem Runs Ranklist
ZOJ Problem Set - 3691
Flower

Time Limit: 8 Seconds      Memory Limit: 65536 KB      Special Judge

Gao and his girlfriend's relationship becomes better and better after they flying balloon last week. Thus, Gao wants to play a simple but evil game with his girlfriend at a late night.

The game is simple: there is a three-dimensional space, Gao chooses N points to put flowers. For the point i, it has Fi flowers. And his girlfriend has to move all these flowers to point 1 altogether. As everyone knows, his girlfriend is not strong like Gao, so she can move flowers from one point to another if and only if the Euclidean distance between two points are smaller or equal to R. In another words, she perhaps has to move flowers to the intermediate point for finally moving all flowers to the point one. In order to stay with his girlfriend as much time as possible, he asks his girlfriend, for the point i, that she can only move out no more than Li flowers (including the points as an intermediate point).

Can you help his poor girlfriend to calculate the minimal R?

#### Input

There are multiple cases.

For each case, the first line contains an integer N (1 ≤ N ≤ 100), which means there are N points.

For the next N lines, each line contains five integers, Xi, Yi, Zi, Fi and Li. Xi, Yi and Zi are the coordinate of point i (0 ≤ Xi, Yi, Zi ≤ 20000), Fi means there are Fi flowers at the beginning. Li means this point can be moved out no more than Li flowers.

#### Output

For each test case, it contains one real number indicating the minimal R. The results should be rounded to seven decimal places. If there is no solution for this case, please output -1. Output's absolute error less than 1e-6 will be accepted.

```2
1 1 1 1 1
2 2 2 2 2
```

#### Sample Output

```1.7320508
```

Author: REN, Qing
Contest: ZOJ Monthly, March 2013
Submit    Status