a, b, s = input().split() a = int(a) b = int(b) c = float(s[3:]) - 9 t = a*60 + b + c*60 print(t) h = int(t//60%24) m = int(t%60 + 0.1) print('{0:02}:{1:02}'.format(h, m))