defmodule Main do
  def main do
    [a,b,h,m]=IO.gets("") |> String.trim |> String.split(" ") |>Enum.map(&String.to_integer(&1)) 
    
    IO.puts(:math.sqrt(a*a+b*b-2*a*b *:math.cos( (h+m/60)*(1-1/12)*2 *:math.pi() )))
  end
end
