You are given a point $$$P$$$ and $$$n$$$ closed disks on the plane.
Disk $$$i$$$ is centered at $$$(x_i, y_i)$$$ and has radius $$$r_i$$$. It contains all points $$$(x, y)$$$ such that $$$$$$ (x - x_i)^2 + (y - y_i)^2 \le r_i^2. $$$$$$
It is guaranteed that the intersection of all $$$n$$$ disks is non-empty.
Find the minimum possible Euclidean distance from $$$P$$$ to a point that belongs to all disks.
The first line contains one integer $$$n$$$ ($$$1 \le n \le 500$$$).
The second line contains two integers $$$p_x$$$ and $$$p_y$$$ ($$$-1'000'000 \le p_x, p_y \le 1'000'000$$$), the coordinates of $$$P$$$.
Each of the next $$$n$$$ lines contains three integers $$$x_i$$$, $$$y_i$$$, $$$r_i$$$ ($$$-1'000'000 \le x_i, y_i \le 1'000'000$$$, $$$1 \le r_i \le 1'000'000$$$).
Print one real number: the minimum distance from $$$P$$$ to the intersection of all disks.
Your answer will be considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$.
3-3 -41 0 10 1 10 0 10
5.000000000000000
The first two disks intersect in a lens whose boundary passes through $$$(0, 0)$$$ and $$$(1, 1)$$$. The third disk contains that whole lens.
The closest point in the common intersection to $$$P = (-3, -4)$$$ is $$$(0, 0)$$$, so the answer is $$$5$$$.
| Name |
|---|


