The curator has decided to spice up the display, and has placed the gem on a purple circular platform, along with mundane orange circular gems.
Starved citizens of circle land (points) have flocked to see the grand exhibit of the exquisite red gem. They cannot step on the purple exhibit floor, but can only stand on the circumference. Unfortunately, the mundane orange gems block the view of the exquisite red gem. Please help the museum folks determine the proportion of the circumference of the purple platform from which all of the red gem is visible, completely unobstructed by the orange gems.
There will be up to $100$ test cases in the input. Each test case will begin with a line with five integers:
$n \ p \ x \ y \ r$
Where $n$ ($1 \le n \le 100$) is the number of orange circles, $p$ ($10 \le p \le 1\, 000$) is the radius of the purple platform, $(x,y)$ is the center of the red gem relative to the center of the purple platform ($-1\, 000 \le x,y \le 1\, 000$), and $r$ ($0 < r \le 1\, 000$) is the radius of the red gem. The red gem is guaranteed to lie fully within the purple platform. No part of the red gem will extend to the boundary of the purple platform. On each of the next $n$ lines will be three integers:
$x \ y \ r$
which represent the $(x,y)$ center ($-1\, 000 \le x,y \le 1\, 000$) relative to the center of the purple platform, and radius $r$ ($0 < r \le 1\, 000$) of each orange gem. As with the red gem, each orange gem is guaranteed to lie entirely within the purple platform. The orange gems will not overlap or touch the red gem, and they will not overlap or touch each other. The input will end with a line with $5$ 0s.
For each test case, output a single floating point number on its own line, indicating the proportion of the perimeter of the purple platform where all of the red gem is visible. This result should be between $0$ and $1$ (inclusive). The absolute error of your answer should be less than $10^{-4}$.
Sample Input 1 | Sample Output 1 |
---|---|
4 10 0 0 1 5 0 2 0 5 2 -5 0 2 0 -5 2 1 25 5 5 1 -5 -5 10 0 0 0 0 0 |
0.308206063 0.658717023 |