a,b,s = input().split() t = 60*(int(a)-9) + int(round(float(s[3:])*60)) + int(b) t %= 1440 a,b = str(t//60), str(t%60) a = "0"*(2-len(a)) + a b = "0"*(2-len(b)) + b print(f"{a}:{b}")