#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

const int R = 6371;
const double PI = acos(-1.0);

int main() {
    freopen("dreamrun.in", "r", stdin);
    freopen("dreamrun.out", "w", stdout);

    double x, y, z;
    cin >> x >> y >> z;

    x = sqrt(x * x + y * y);
    double alph = acos(x / R);

    double toEquator = 0;
    if (z >= 0) {
        toEquator = alph * R;
        alph = 0;
    }

    double l = 0, r = PI / 2 - alph;

    for (int i = 0; i < 10000; i++) {
        double m = (l + r) / 2;

        double walked = toEquator + m * R;
        double around = 2 * PI * R * cos(alph + m);

        if (walked < around) {
            l = m;
        } else {
            r = m;
        }
    }

    cout.precision(11);
    cout << fixed << toEquator + l * R;

    return 0;
}
