using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace pf4 { class Program { static void Main(string[] args) { int[] tmp = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray(); int N = tmp[0]; int H = tmp[1]; int M = tmp[2]; int T = tmp[3]; for (int i = 1; i < N; i++) { M = M + T; } H = H + M / 60; H = H % 24; M = M % 60; Console.WriteLine(H); Console.WriteLine(M); } } }