#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void)
{
    double PI = 3.141593653589793238462643383279502;
    double pans;
    double A;
    double B;
    double H;
    double M;
    scanf("%lf", &A);
    scanf("%lf", &B);
    scanf("%lf", &H);
    scanf("%lf", &M);
    pans = (A - B) * (A - B) + 4.0 * A * B * sin(PI * (-H / 12.0 + 11.0 * M / 720.0)) * sin(PI * (-H / 12.0 + 11.0 * M / 720.0));
    printf("%.12lf", sqrt(pans));
    return 0;
}