import Data.Char main = do [a,b,s] <- words <$> getLine let m = read a * 60 + read b let sig = if any (=='+') s then 1 else (-1) let d = sig * (read $ takeWhile isDigit $ dropWhile (not.isDigit) s) - 9 let f = if any (=='.') s then True else False let m' = mod (m + d * 60 + if f then 30 else 0 + 1440) 1440 putStrLn $ show2 (div m' 60) ++ ":" ++ show2 (mod m' 60) show2 = reverse . take 2 . reverse . ("0" ++) . show