# -*- coding: utf-8 -*- """ No.652 E869120 and TimeZone https://yukicoder.me/problems/no/652 """ import sys from sys import stdin input = stdin.readline def decode_time(S): S = S[3:] if not '.' in S: return int(int(S) * 60) else: hh, mm = S.split('.') hh = int(hh) * 60 mm = int(mm) * 6 if S[0] == '-': return hh - mm else: return hh + mm def main(args): a, b, S = input().split() a = int(a) b = int(b) japanese_time = a * 60 + b time_diff = decode_time(S) ans = japanese_time + time_diff - 540 if ans < 0: ans += 60 * 24 elif ans >= 60 * 24: ans -= 60 * 24 hh = ans // 60 mm = ans % 60 print('{:02d}:{:02d}'.format(hh, mm)) if __name__ == '__main__': main(sys.argv[1:])