program colon
  implicit none
  real(8), parameter :: deg2rad = 3.14159265358979d0/180.d0
  real(8) :: a, b, h, m, c, p, q
  character(64) :: s
  read(*,*) a, b, h, m
  p = 30.d0*h+0.5d0*m
  q = 6.d0*m
  c = sqrt(a*a+b*b-2.d0*a*b*cos((p-q)*deg2rad))
  write(s,'(f32.16)') c
  write(*,'(a)') trim(adjustl(s))
end program colon