a, b, s = input().split() a = int(a) b = int(b) t = a * 60 + b if len(s) == 5: x = int(s[3:]) else: x = float(s[3:]) x *= 60 x = int(x) d = x - 60 * 9 t += d if t < 0: t += 24 * 60 elif t >= 24 * 60: t -= 24 * 60 h, m = divmod(t, 60) print(f"{h:02}:{m:02}")