program main
  implicit none
  integer i
  real(8) dX, dY, P, ans, A, B, H, M
  read(*, *)A, B, H, M
  !read(*, *) (L(i), i = 1,N)
  P = 3.141592653589793238462643383279
  P = 2*P
  P = P/12
  H = H + M/60
  M = M/5
  dX = A*cos(-P*H)-B*cos(-P*M)
  dY = A*sin(-P*H)-B*sin(-P*M)
  ans = (dX**2+dY**2)**(0.5)
  write(*, *) ans
end program main
