program main
    implicit none
    real(8) a, b, h, m
    real(8) the_a, the_b
    real(8) xa, ya, xb, yb
    real(8) d
    read(*,*) a, b, h, m

    the_a = (h+m/6d1)/1.2d1*2d0*3.14159265358979d0
    the_b = m/6d1*2d0*3.14159265358979d0

    xa = a*cos(the_a)
    ya = a*sin(the_a)

    xb = b*cos(the_b)
    yb = b*sin(the_b)

    d = sqrt((xa-xb)**2d0 + (ya-yb)**2d0)
    
    write(*,*) d

end program