using System; using System.Linq; class Program { static void Main(string[] args) { var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList(); var N = input[0]; var H = input[1]; var M = input[2]; var T = input[3]; var date = new DateTime(2019, 1, 1, H, M,0); var awake = date.AddMinutes(T * (N - 1)); Console.WriteLine("{0}\n{1}\n", awake.Hour, awake.Minute); } }