import Foundation

func readArrayDouble() -> [Double] {
    readLine()!.split(separator: " ").map({Double($0)!})
}

let line = readArrayDouble()
let (A, B, H, M) = (line[0], line[1], line[2], line[3])
print((A * A + B * B - 2 * A * B * cos(11 * Double.pi * (H + M / 60) / 6)).squareRoot())
