import ru.ifmo.testlib.Checker;
import ru.ifmo.testlib.InStream;
import ru.ifmo.testlib.Outcome;
import static ru.ifmo.testlib.Outcome.Type.*;

public class Check implements Checker {
    public Outcome outcome(Outcome.Type type, final String format, final Object... args) {
        return new Outcome(type, String.format(format, args));
    }

    final double EPS = 2e-9;

    public Outcome test(InStream inf, InStream ouf, InStream ans) {
        double ja = ans.nextDouble();
        double pa = ouf.nextDouble();
        double relative_error = Math.abs(ja - pa) / Math.max(Math.abs(ja), 1.0);
        double absolute_error = Math.abs(ja - pa);
        double error = Math.min(relative_error, absolute_error);
        if (error <= EPS) {
            return outcome(OK, "%.17f", pa);
        }
        return outcome(WA, "Expected %.17f, found %.17f, error = %.17f", ja, pa, error);
    }
}
