Module Module1

    Sub main()
        Dim user2 As List(Of String) = New List(Of String)(Split(Console.ReadLine(), " "))
        Dim rangeA As Long = user2(0)
        Dim rangeB As Long = user2(1)
        Dim timeA As Long = user2(2)
        Dim timeB As Long = user2(3)

        ' 中心の角度を求める
        Dim arc As Double = (60 * timeA + timeB) * 0.5 - timeB * 6
        arc = arc - 2 * (arc - 180)
        'Console.WriteLine("角度：" & arc)

        ' 辺の長さを求める
        Dim ans = rangeA ^ 2 + rangeB ^ 2 - 2 * rangeA * rangeB * Math.Cos(arc * Math.PI / 180)

        'Console.WriteLine(ans)
        ans = Math.Sqrt(ans)

        Console.WriteLine(ans)
    End Sub
End Module