#K67122. Maximum Running Distance in the Forest

    ID: 32573 Type: Default 1000ms 256MiB

Maximum Running Distance in the Forest

Maximum Running Distance in the Forest

In this problem, you are given m trees positioned in a forest. Each tree is described by its coordinates (x, y) and a maximum running distance d representing the maximum distance a friend starting at that tree can run without leaving the forest.

Moreover, if the running circles of two trees overlap, i.e. if the Euclidean distance between the two trees is not greater than the sum of their running distances, then the overlapping region provides an alternative way to determine the safe running distance. In particular, for any two trees with parameters \(d_1\) and \(d_2\) and with distance \(D\) between them (where \(D = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}\)), a candidate running distance is given by:

[ \min\left(d_1,; d_2,; \frac{D}{2}\right)]

Your task is to compute the maximum running distance that any friend can achieve without breaking the rules, by considering both individual tree limits and overlapping possibilities.

inputFormat

The first line contains a single integer m (1 ≤ m ≤ 105), the number of trees.

Each of the next m lines contains three integers: x, y, and d (the x-coordinate, y-coordinate, and the maximum running distance for that tree respectively). All values are separated by spaces.

It is guaranteed that all input values are valid.

outputFormat

Output a single floating-point number representing the maximum running distance achievable, rounded to six decimal places.

## sample
1
0 0 5
5.000000