import java.util.Scanner; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int h = in.nextInt(); int m = in.nextInt(); int t = in.nextInt(); if(n == 1) { System.out.println(h); System.out.println(m); } else { for(int i=0; i= 60) { h++; m -= 60; } } System.out.println(h % 24); System.out.println(m); } // h * 60 + m + t * (n - 1) // int at = h * 60 + m + t * (n - 1); // System.out.println(at / 60 % 24); // System.out.println(at % 60); in.close(); } }