import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Sample01 { public static void main(String[] args) throws IOException{ int[] x; x= new int[4]; BufferedReader num =new BufferedReader(new InputStreamReader(System.in)); for(int i = 0; i < 4; i++){ String n = num.readLine(); x[i]= Integer.parseInt(n); } for(int w = 0; w < x[0] - 1; w++){ x[2] += x[3]; } while(x[2] > 59){ x[1]++; if(x[1] > 23){ x[1] = 0; } x[2] = x[2] - 60; } System.out.println(x[1]); System.out.println(x[2]); } }