Zen's Garden

Time Limit: 1000 ms

Memory Limit: 65535 ms

Description

Zen's Garden is eagerly waiting for you who are obviously a genius. The little snail in the garden needs your help with collecting silver coins.
In this lovely garden there're a lot of plants which can produce coins randomly. Coins can come out from any plant at any place at any time. At the very beginning (time is began with 0), our snail will be at the coordinate (0, 0) ready for coins' coming up and going over to collect them.
But we should pay more attention to two things. It will take 10 seconds from a coin shows up to its vanish. And the snail is at the const speed of 10 per seconds unless he stops. It still works if little snail reach the coin at the moment it vanishes.
Now I give you a set of coins' information, please tell little snail if he can collect all the coins. If the answer is yes, please give the fastest time to collect all.

Input

There are multiple cases. Each case has (n+1) lines. First line is a number n (n<31), indicates the number of coins. For each coin there is a line with 3 numbers: t (t>=0), x and y (x, y>=0). The coin will show up at the time of t, and the place of (x, y).

Output

Each case one line is needed. If you can find the fastest way please give the shortest time (accurate to 0.001). Or you can print -1 if you can't find one.

Sample Input

1
1 100 100
1
200 100 100

Sample Output

-1
200.000

Hint

Source

JiaQiong

提交代码