eolymp
bolt
Try our new interface for solving problems
Problems

Big jumps

Big jumps

\includegraphics{https://static.e-olymp.com/content/fb/fb06f9a3c9d4b7d0fad90e2c6e52c9c7f70ca0ef.jpg} In one very large city unusual racing suit. From normal seeds, they differ in that are not on the racetrack, and a specially harvested track. She represents the infinite line in the plane. The track is very long, so the competition can be drawn is not on the same day and place not only during the day but at night. Organizers think deeply about how they will cover the route, because to cover an infinitely long track is not so simple. To this end they have bought N floodlights will be installed at certain points in the city. It is known that the floodlights illuminate the ground, forming a circle. It so happened that the company that installed equipment, confused the installation site, so some floodlights may not even cover the route. Now the competition can fail, the organizers are very concerned that viewers will not see the most interesting moments of the competition due to an error of masters. Help the organizers to find out what the length of the illuminated side of the road. \InputFile The first line contains four numbers \textbf{x_1}, \textbf{y_1}, \textbf{x_2}, \textbf{y_2} --- coordinates of two points on the line. In the second - row number \textbf{N} (\textbf{1} ≤ \textbf{N} ≤ \textbf{100000}) --- the number of fixtures. In each of the next \textbf{N} lines are given \textbf{3} numbers \textbf{x}, \textbf{y} and \textbf{R}, the coordinates and radius of the circle formed by the searchlights. All coordinates and radii - integers not exceeding modulo \textbf{10^5}. \OutputFile The output file output the answer to the problem, up to \textbf{10^\{−4\}}.
Time limit 2 seconds
Memory limit 64 MiB
Input example #1
0 0 1 1
1
5 5 1
Output example #1
2.0000