a, b, s = input().split() a = int(a) b = int(b) t = a * 60 + b if '.' not in s: x = int(s[3:]) x *= 60 else: x = s[3:] x, f = x.split('.') x = int(x) x *= 60 f = int(f) f *= 6 if '+' in s: x += f else: x -= f 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}")