import Control.Monad
import Control.Applicative

toClock :: Int -> [Int]
toClock time =
  let s = time `mod` 60
      m = time `div` 60
  in
      [m, s]

solver :: [Int] -> [Int]
solver = toClock . sum

main :: IO()
main = do
  times <- map (read :: String -> Int) <$> replicateM 4 getLine
  mapM_ print $ solver times