a,b,S = map(str, input().split()) a = int(a) b = int(b) c = 0 d = 0 for i in range(4, len(S)): if S[i] == ".": continue if 4 <= i <= 5: c = c*10 + int(S[i]) else: d = 6*int(S[i]) if S[3] == "+": delta = c*60+d - 540 else: delta = -c*60-d -540 time = a*60+b + delta h = (time//60)%24 m = time%60 if h < 10: h = "0" + str(h) else: h = str(h) if m < 10: m = "0" + str(m) else: m = str(m) print(h+":"+m)