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 = sig * if any (=='.') s then (read [last s] * 6) else 0 let m' = mod (m + d * 60 + f + 1440) 1440 putStrLn $ show2 (div m' 60) ++ ":" ++ show2 (mod m' 60) show2 = reverse . take 2 . reverse . ("0" ++) . show