414. Orthogonal Circles

Time limit per test: 0.5 second(s)
Memory limit: 262144 kilobytes
input: standard
output: standard

Two circles are orthogonal, if they intersect and for any point of intersection their tangent lines at that point are perpendicular.

Consider a set of n circles on the plane. You are to find a circle orthogonal to all of them.

The input file contains an integer n (1 ≤ n ≤ 105), followed by n triples of integers: xi, yi, ri, denoting the center coordinates and the radii of the circles (-106xi, yi ≤ 106, 1 ≤ ri ≤ 106).

The circles may coincide.

If there exists exactly one circle orthogonal to all the given ones, output its center coordinates and radius as real numbers separated with single spaces. The numbers will be considered correct if they are within 10-6 relative or absolute error of the exact answers.

In case there's no such circle, output -1. In case there are many, output -2.

sample input
sample output
0 0 5
7 16 10
10 0 5
5.0 5.0 5.0

The example is illustrated by the following picture:

Online Contester Team © 2002 - 2010. All rights reserved.