Goddess

Time Limit: 20000/10000 MS (Java/Others)

Memory Limit: 32768/32768 K (Java/Others)

Description

Goddess used to be a good friend of Jitui, but Jitui has always been busy solving algorithm problems which makes Goddess very upset. In order to punish Jitui, Goddess will send N spaceships to attack Jitui’s LAB (Lost Algorithm Base). Jitui’s LAB is going to use laser weapons to destroy some of the spaceships.
The whole space can be seen as a two-dimensional coordinate system. Jitui’s LAB is a single point located at (0, 0). Each spaceship can be considered as a circle with center at (xi, yi) and radius ri. Laser weapon can be viewed as a ray starting from (0, 0), and in a direction chosen by Jitui. For each spaceship, the sum of length of segments that covered by the ray is the total damage made by the laser. Note that spaceships may overlap, which means the length that the laser weapon covers each spaceship may be calculated more than once. Jitui wants you to help him calculate the maximum damage he can make.
The number of spaceships N will not exceed 200. All centers of spaceships are guaranteed to be in the square with the left-down point at (-1000, -1000) and the right-up point at (1000, 1000). No spaceship will cover the point of (0, 0).

Input

There are several test cases. Please process till EOF.
For each case, the first line contains a number N that denotes the number of spaceships. Then next N lines, i-th line contains three numbers x, y, r denotes the coordinate of the center (x and y) and radius (r) of the i-th spaceship.

Output

For each case, output the maximized damage made by Jitui’s laser weapon.
Your output will be considered correct if within an absolute error less than 10-6.

Sample Input

1 50 0 10 2 30 0 10 60 20 20

Sample Output

20.0000000000 53.0366762251

Hint

liuyiding

Source

2014西安全国邀请赛

提交代码