main :: IO() main = getContents >>= putStrLn . show . listToValue . (map readDouble) . words readDouble :: [Char] -> Int readDouble = read hours :: Int -> Int hours x = x * 3600 minutes :: Int -> Int minutes x = x * 60 listToValue :: [Int] -> Int listToValue (x:y:z:_) | minutes x == y = -1 | result < 0 = -1 | otherwise = result where -- calc :: (RealFrac a , Integral b) => a -> a -> a -> b calc :: Int -> Int -> Int -> Int calc x y z = ceiling ( ( (toDouble (hours z)) / (toDouble ((minutes x) - y)))) result = calc x y z toDouble:: Int -> Double toDouble x = fromIntegral x