const Main = input => { // inputにはすべての入力の文字列が与えられるので必要に応じて input.split("\n") などで分割する。 const lines = input.split("\n") let [n, h, m, t] = lines[0].split(' ').map(item => parseInt(item)) let sleeptime = t * n-1; m += sleeptime m %= 60 h += Math.floor(m/60) console.log(h%24) console.log(m) } // Don't edit this line! Main(require("fs").readFileSync("/dev/stdin", "utf8"));