eolymp
bolt
Try our new interface for solving problems
Problems

Coverage

Coverage

A cell phone user is traveling along a line segment with end points having integer coordinates. In order for the user to have cell phone coverage, it must be within the transmission radius of some transmission tower. As the user travels along the path, cell phone coverage may be gained (or lost) as the user moves inside the radius of some tower (or outside of the radii of all towers). Given the location of up to 100 towers and their transmission radii, you are to compute the percentage of cell phone coverage the user has along the specified path. The (x, y) coordinates are integers between -100 and 100 inclusive, and the tower radii are integers between 1 and 100 inclusive.

Input

Your program will be given a sequence of configurations, one per line, of the form: n c0x c0y c1x c1y t1x t1y t1r t2x t2y t2r ... Here n is the number of towers, (c0x, c0y) is the start of path of the cell phone user, (c1x, c1y) is the end of the path, (tkx, tky) is the position of the k-th tower, and tkr is its transmission radius. The start and end points of the paths are distinct. The last problem is terminated by the line 0.

Output

For each configuration, output one line containing the percentage of coverage the cell phone has, rounded to two decimal places.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3 0 0 100 0 0 0 10 5 0 10 15 0 10
1 0 0 100 0 40 10 50
0
Output example #1
25.00
88.99
Source 2009 ACM North America - Rocky Mountain, Problem B