ln=input().split() hour=int(ln[0]) minute=int(ln[1]) lag=float(ln[2].replace('UTC',''))-9.0 lagmin=60*(lag-int(lag)) hour+=lag+24 minute+=lagmin+60.0 print('%d:%d'%(hour%24,round(minute,1)%60))