using System; using System.Text; using System.Collections.Generic; public class Test { public static void Main() { string[] poczatek = Console.ReadLine().Trim().Split(':'); int[] czas = new int[] { int.Parse(poczatek[0]), int.Parse(poczatek[1]) }; string p; List przerwy = new List(); while ((p = Console.ReadLine()) != null) { przerwy.Add(int.Parse(p)); } int a = 0; int max = przerwy.Count - 1; StringBuilder sb = new StringBuilder(); do { sb.Append(string.Format("{0:00}:{1:00},", czas[0], czas[1])); czas[1] += przerwy[a++]; if (czas[1] >= 60) { do { czas[0]++; czas[1] -= 60; } while (czas[1] >= 60); } if (czas[0] > 24) { do { czas[0] -= 24; } while (czas[0] > 24); } if (czas[0] == 24) { czas[0] = 0; sb.Append(string.Format("{0:00}:{1:00}", czas[0], czas[1])); break; } if (a > max) a = 0; } while (czas[0] + czas[1] < 84); if(sb[sb.Length-1]==',') Console.Write(sb.ToString().Remove(sb.Length - 1)); else Console.Write(sb.ToString()); } }