import java.util.*; import static java.lang.System.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int h = sc.nextInt(); int m = sc.nextInt(); String s = sc.next(); //日本の時刻(分) int japan = h*60+m; //X国の時刻を求める //余計な部分を取り除く int dif = (int)(Double.parseDouble(s.replaceAll("[UTC+]",""))*60); //日本時間の9を引いてやることによって、 //X国の現在時刻が日本とどれだけずれているかが求まる。 dif = dif-540; //X国の時刻(分) int x = japan+(int)dif; //以下、これを時と分の表記に直す x %= 1440; if (x<0) { x += 1440; } int H = x/60; int M = x%60; //直せたので、あとは出力するだけ String ans = ""; if (H < 10) {ans += "0";} ans += H + ":"; if (M < 10) {ans += "0";} ans += M; out.println(ans); } }