import std.conv, std.stdio;
import std.algorithm, std.array, std.range, std.string;
import std.math;
void main()
{
    auto buf = readln.chomp.split.to!(int[]);
    immutable
        theta0 = 2 * PI * (buf[2] / 12.0L + buf[3] / 720.0L),
        theta1 = 2 * PI * (buf[3] / 60.0L),
        x0 = buf[0] * cos(theta0),
        y0 = buf[0] * sin(theta0),
        x1 = buf[1] * cos(theta1),
        y1 = buf[1] * sin(theta1);
        stderr.writefln("%f %f %f %f %f %f", theta0, theta1, x0, y0, x1, y1);
    "%.8f".writefln(sqrt((x0-x1) ^^ 2 + (y0-y1) ^^ 2));
}
