This page is still under construction.

Parts of this page are still being built. What you see may change.

Flight of a Dream

Time limit2sMemory limit512 MB

Summary
Given a start point on a sphere, find a distance d so that flying d south, d west, then d north returns to the start while staying 1 km from the South Pole.
Level

Medium7 of 10

Topics
Geometry, Math, Implementation, Binary search
Solved
No attempts yet

Problem

Dima is taking part in an international paragliding olympiad. Every participant must complete the following task. Starting from a given point, fly dd kilometers south, then dd kilometers west, and then dd kilometers north. As a result of this flight, the participant must return to the starting point!

A participant is not allowed to come closer than one kilometer to the South Pole, because a tower with the olympiad jury stands there.

Each participant chooses the value of dd independently, subject only to the condition d≥1d \ge 1. Dima quickly realized that choosing dd is not so easy, and turned to you for help.

Treat the Earth as a sphere centered at (0,0,0)(0, 0, 0) with radius 63716371 kilometers. The North and South Poles have coordinates (0,0,6371)(0, 0, 6371) and (0,0,−6371)(0, 0, -6371), respectively. The starting point has three-dimensional coordinates (x,y,z)(x, y, z), where xx, yy, and zz are integers, and the start lies on the surface of the Earth, that is, x2+y2+z2=63712x^2+y^2+z^2=6371^2.

Help Dima choose a real number d≥1d \ge 1 such that, starting from the given point and flying dd kilometers south, then dd kilometers west, and then dd kilometers north, he returns to the starting point without passing close to the South Pole.

Input

The single line of the input file contains three integers xx, yy, zz, the coordinates of the start in the system described above.

The start lies on the surface of the Earth, and the distance from the starting point to the South Pole is at least 10 kilometers.

Output

Print a single real number, the required dd. The answer is considered correct if d≥1d \ge 1 and the distance between the starting point and the endpoint of the path is at most 10−610^{-6}.

If several values of dd are possible, print any of them. At least one dd satisfying the conditions of the problem is guaranteed to exist.

Examples1

  1. Example 1

    Input
    0 0 6371
    
    Expected output
    239.0