import ru.ifmo.testlib.Checker;
import ru.ifmo.testlib.InStream;
import ru.ifmo.testlib.Outcome;

import static java.lang.Math.*;

public class Check implements Checker {
    private static final int R = 6371;
    private static final double eps = 1e-8;
    private static final double poleEps = 1;
    private static final double finalEps = 1e-6;

    @Override
    public Outcome test(InStream inf, InStream ouf, InStream ans) {
        int iX = inf.nextInt();
        int iY = inf.nextInt();
        int iZ = inf.nextInt();

        double x = iX;
        double y = iY;
        double z = iZ;

        double startR = sqrt(x * x + y * y);

        double a = ouf.nextDouble();

        if (a < 1) {
            return new Outcome(Outcome.Type.WA, "a < 1");
        }

        double alphA = a / R;

        x = sqrt(x * x + y * y);
        y = 0;

        double alphX = acos(x / R);

        if (z < 0) {
            alphX = -alphX;
        }

	if (alphX + PI / 2 < norm(alphA) + eps) {
            return new Outcome(Outcome.Type.WA, "South pole reached");
        }

        alphX -= alphA;
        alphX = norm(alphX);

        double alphSouthPole = min(abs(alphX - 3 * PI / 2), abs(alphX + PI / 2));
        double toSouthPole = alphSouthPole * R;
        if (toSouthPole < poleEps - eps) {
            return new Outcome(Outcome.Type.WA, "Too close to the south pole");
        }

        z = sin(alphX) * R;
        x = cos(alphX) * R;

        double r = abs(x);
        double alphB = norm(a / r);

        double dist = abs(min(alphB, 2 * PI - alphB) * startR);

        if (dist > finalEps) {
            return new Outcome(Outcome.Type.WA, String.format("Dist between end and start points is %.9f", dist));
        }

        return new Outcome(Outcome.Type.OK, String.format("Dist between end and start points is %.9f", dist));
    }

    private double norm(double ang) {
        while (ang < 0) {
            ang += 2 * PI;
        }

        while (ang > 2 * PI) {
            ang -= 2 * PI;
        }
        return ang;
    }
}
