/* ex4_1
  terakura */

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

int main(void){
    double short_hund, long_hund, hour, minute, angle, area;
    scanf("%lf %lf %lf %lf", &short_hund, &long_hund, &hour, &minute );

    angle = (hour / 12)*2 * M_PI - (minute / 60)*2 * M_PI ;     //短針と長針のなす角度(ラジアン)
    area = sqrt( pow(short_hund, 2) + pow(long_hund, 2) - 2 * short_hund * long_hund * cos(angle));     //余弦定理で面積を計算

    printf("%lf\n", area);

    return 0;
}
