d=list(map(int,input().split())) c=d[2]+d[3]*(d[0]-1) print(f"{d[1]+c//60}:{c%60:0>2}")