import java.util.Scanner; public class cade { public static void main(String[] args) { Scanner s = new Scanner(System.in); int[] A = new int[4]; for(int i=0;i<4;i++){ A[i] = Integer.parseInt(s.next()); } int h = A[1] * 60; int startmin = h + A[2]; int Dmin = 24 * 60; for(int i=0;i= Dmin){ startmin %= Dmin; } } int ansh= startmin / 60; if(ansh == 24){ ansh = 0; } int ansm= startmin % 60; System.out.println(ansh + "\n" + ansm); } }