import sequtils,strutils,strscans,math var t : float s = stdin.readline.split h,m : int (h, m) = s[0..1].map(parseInt) if scanf(s[2],"UTC+$f",t): discard elif scanf(s[2],"UTC-$f",t): t = -1 * t h += t.int - 9 m += round((t mod 1) * 60).int if m >= 60: h += 1 m -= 60 elif m < 0: h -= 1 m += 60 if h < 0: h += 24 elif h >= 24: h -= 24 var H = $h M = $m if H.len == 1: H = "0" & H if M.len == 1: M = "0" & M echo H, ":", M