const fs=require('fs');
const input=fs.readFileSync('/dev/stdin').toString().trim().split('\n');
let [hour, minute] = input[0].split(' ').map(Number);
let delay = Number(input[1]);
minute += delay;
if(minute >= 60){
hour += parseInt(minute/60);
minute %= 60;
if(hour >= 24){
hour %= 24;
}
}
console.log(hour+ ' ' + minute)
14 30
20