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

Int main(void)
{
    int a, b, h, m;
    double C;
    scanf(“%d %d %d %d” ,&a, &b, &h, &m);
    C=sqrt((a^2)+(b^2)-(2 *a *b * cos((M_PI * ((5.5 * m)-(30 * h)))/180)));
    printf(“%f” , C);
    return 0;
}