import math a, b, s = input().split() a = int(a) b = int(b) utc = a * 60 + b - 540 diff = "".join(filter(lambda x:x.isdigit() or x == ".", s)) diff = float(diff) s = list(s) res = 0 if s[3] == "+": d = diff * 60 res = utc + math.ceil(d) elif s[3] == "-": d = diff * 60 * (-1) res = utc + math.ceil(d) if res >= 1440: h = res // 60 - 24 m = res % 60 elif res <=0: h = res // 60 + 24 m = res % 60 else: h = res // 60 m = res % 60 print(f'{h:0=2}:{m:0=2}')