/* 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 );


//短針とが０時０分の為す角は(”時間”＊2π/12) + (π/6の”分”ぶんの60)
    angle = (hour *  (2 * M_PI / 12) +( M_PI / 6 * minute / 60)) -(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;
}
