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:_) | result < 0 = -1 | otherwise = result where result = 1 + (div (hours z) $ (minutes x) - y)