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