#yuki652 import math a,b,s=raw_input().split() x=s.lstrip('UTC') n=float(x) n1=math.trunc(n) m=n-n1 x=m*60 x1=int(round(x)) x2=n1*60+x1 ref=9*60 ref1=x2-ref res=int(a)*60+int(b) res1=ref1+res if res1<0: res1+=24*60 res2=res1/60 if res2>=24: res2=res2-24 res3=res1%60 print ''.join(str(res2).zfill(2)+':'+str(res3).zfill(2))