program colon
implicit none
integer a, b, h, m
double precision p
double precision x2
read *, a, b, h, m
!print *, a
!print *, b
!print *, h
!print *, m
p = 4d0*datan(1d0)
!print *, m/60.
!print *, h/12. + m/720.
x2 = a**2 + b**2 - 2d0 * a * b * dcos((h/12d0-m*11d0/720d0)*2d0*p)
print *, sqrt(x2)
end program