from math import isclose def main(): a, b, c = input().split() h = int(a) m = int(b) delta = float(c.replace("UTC", "")) - 9 h += int(delta) h = h % 24 m += round((delta - int(delta)) * 60) if not isclose(m, 0): m += 60 h -= 1 if not isclose(h, 0): h += 24 h += m // 60 m = m % 60 h = h % 24 print(f"{h:02d}:{m:02d}") if __name__ == "__main__": main()