import qualified Data.ByteString.Char8 as C
import Data.List
import Data.Complex

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

main :: IO ()
main = do
    [a,b,h,m] <- map fromIntegral <$> r' :: IO [Float]
    let a' = a :+ 0
        b' = b :+ 0
        i  = 0 :+ 1
        h' = i ** (4 * (60 * h + m) / (60 * 12) :+ 0)
        m' = i ** (4 * m / 60 :+ 0)
    print $ magnitude (a' * h' - b' * m')