open System
open System.Numerics
 
let flip f a b = f b a
let read() = Console.ReadLine()
let pi = float32 Math.PI
let pi2 = pi * 2.0f
 
[<EntryPoint>]
let main _ =
    let str = read().Split(' ')
    let a = float32 str.[0]
    let b = float32 str.[1]
    let h = float32 str.[2]
    let m = float32 str.[3]
    
    let h = h / 12.0f * pi2
    let m = m / 60.0f * pi2
    
    let a = Vector2(cos(h), sin(h)) * a
    let b = Vector2(cos(m), sin(m)) * b
    
    let len = (a - b).Length()
    
    printfn "%f" len
    
    0 