using System.Collections.Generic; using System; using System.Linq; using System.Drawing; namespace yukicoder { class Program { static void Main(string[] args) { var n = Console.ReadLine(); var n1 = n.Split(" "); int N = int.Parse(n1[0]); int H = int.Parse(n1[1]); int M = int.Parse(n1[2]); int T = int.Parse(n1[3]); int hun = T * (N - 1); if (M + hun >= 60) { H = H + ((M + hun) / 60); H = H % 24; M = (M + hun) % 60; Console.WriteLine(H); Console.WriteLine(M); } else if (M + hun <= 60) { M = M + hun; Console.WriteLine(H); Console.WriteLine(M); } } } }