main :: IO ()
main = do
  [a, b, h, m] <- map read . words <$> getLine
  print $ solve a b h m

solve :: Double -> Double -> Double -> Double -> Double
solve a b h m = sqrt $ (a_x - b_x) ^ 2 + (a_y - b_y) ^ 2
  where
    rad_a = 2 * pi * (h / 12 + m / 720)
    rad_b = 2 * pi * (m / 60)

    a_x = a * sin rad_a
    a_y = a * cos rad_a

    b_x = b * sin rad_b
    b_y = b * cos rad_b
