import java.util.Scanner object ndone { def main(args: Array[String]): Unit = { val sc = new Scanner(System.in) val n, h0, m0, t = sc.nextInt var h1, h2, m1, m2 = 0 var over = (n-1)*t m1 = m0 + over if(m1 < 60) { println(h0) println(m1) } else { h1 = h0 + m1 / 60 m2 = m1 % 60 if(h1 < 24) { println(h1) println(m2) } else { h2 = h1 % 24 println(h2) println(m2) } } } }