program c
    implicit none
    real(16) :: A,B,H,M,ans,pi

    read(*,*) A,B,H,M

    ans = 0.0_16
    pi = 3.1415926535897932384_16
    ans = ans + (A*cos(pi*H/6.0_16 + pi*M/360.0_16) - B*cos(pi*M/30.0_16))**2
    ans = ans + (A*sin(pi*H/6.0_16 + pi*M/360.0_16) - B*sin(pi*M/30.0_16))**2
    ans = sqrt(ans)
	write(*,*) ans
    stop
end program c