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

int main(void){

    int A;
    int B;
    int H;
    int M;
    int k;
    int l;
    int x;
    int y;
    int z;

    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &H);
    scanf("%d", &M);

    k = M * 6; 
    l = H * 30 + 0.5 * M;　
    x = k - l;
    y = abs(x);

    z = pow(A, 2.0) + pow(B, 2.0) - A * B *  cos(y);
    z = sqrt(z);

    printf("%d¥n", z);

    return 0;
}