let pi = 4. *. atan 1.
let _ = Scanf.sscanf (read_line()) "%f %f %f %f" (fun a b h m ->sqrt @@ a *. a +. b *. b -. 2. *. a *. cos ((pi *. m /. 30.) -. (pi *. (h /. 6. +. m /. 360.)))) |> Printf.printf "%f\n"
