# coding: utf-8 import math mix= input().split() h=int(mix[0]) m=int(mix[1]) zure=float(mix[2].replace("UTC",""))-9 lzu = math.floor(zure) szu = (zure*10-lzu*10)*6 print(zure) mm = int(m+szu) if mm < 0: mm+=60 h-=1 elif mm>=60: mm-=60 h+=1 else: pass if 0<=mm<=9: mmm="0"+str(mm) else: mmm=str(mm) hh=h+lzu if hh>=24: hh-=24 elif hh<0: hh+=24 if 0<=hh<=9: hhh="0"+str(hh) else: hhh=str(hh) print(hhh+":"+mmm)