let pi2 = atan 1. *. 8.

let () = Scanf.scanf "%d %d %d %d" @@ fun a b h m ->
  let x = float_of_int a *. sin ((float_of_int h +. float_of_int m /. 60.) *. pi2 /. 12.) in
  let y = float_of_int a *. cos ((float_of_int h +. float_of_int m /. 60.) *. pi2 /. 12.) in
  let x' = float_of_int b *. sin (float_of_int m *. pi2 /. 60.) in
  let y' = float_of_int b *. cos (float_of_int m *. pi2 /. 60.) in
  Printf.printf "%.15f" @@ sqrt @@ (x -. x') *. (x -. x') +. (y -. y') *. (y -. y')


