Under construction

Still being built. Things may change

Hadron Colliders

Time limit2sMemory limit1024 MB

Summary
Find a circle that intersects each of up to three given disjoint circles at two diametrically opposite points, i.e. cuts every circle in half.
Level

Hard8 of 10

Topics
Geometry, Math, Brute force, Implementation
Solved
No attempts yet

Problem

Two countries, Bytelandia and Flatlandia, decided to combine their efforts in high-energy physics research and built nn hadron colliders. Each collider has the shape of a ring and lies underground. The thickness of each collider is negligible, so each one can be treated as a circle.

Hadron colliders are complicated devices that demand constant attention. Neither country wanted to take on the maintenance of all the colliders alone, so they decided to split the maintenance between the two countries. To keep things fair, each country would maintain exactly half of every collider. The boundary between the zones of responsibility would be drawn as a circle. Thus we must find a circle that splits each collider into two parts of equal length, that is, a circle that meets each collider at two diametrically opposite points.

Write a program that, given a description of the colliders that were built, finds a circle satisfying these requirements.

Input

The first line of the input file contains an integer nn (1≤n≤31 \le n \le 3). Each of the next nn lines contains a description of one collider. A collider description consists of three integers: xx, yy, rr, the coordinates of the collider's center and its radius (∣x∣,∣y∣≤1000|x|, |y| \le 1000, 1≤r≤10001 \le r \le 1000). The colliders share no points, none lies inside another, and when n=3n=3 their centers do not lie on one line.

Output

On the first line of the output file, print a description of the required boundary: the coordinates of the circle's center and its radius. Print as many digits after the decimal point as possible. When the answer is checked, errors not exceeding 10−510^{-5} are ignored.

The absolute values of the center coordinates and the radius must not exceed 10710^7. A solution satisfying this restriction is guaranteed to exist.

Examples2

  1. Example 1

    Input
    2
    2 0 1
    -2 0 1
    
    Expected output
    0 0 2.2360679774997897
    
  2. Example 2

    Input
    3
    0 10 1
    0 0 2
    10 10 3
    
    Expected output
    5.4 4.85 7.52877812