import java.io.InputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.PriorityQueue; import java.util.Scanner; import java.util.Set; import java.util.Stack; import java.util.TreeMap; import java.util.TreeSet; import static java.util.Comparator.*; public class Main { public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out); Solver solver = new Solver(System.in, out); solver.solve(); out.close(); } } class Solver { Scanner sc; PrintWriter out; public Solver(InputStream in, PrintWriter out) { sc = new Scanner(in); this.out = out; } // ================================================================== public void solve() { int A = Integer.parseInt(sc.next()); int B = Integer.parseInt(sc.next()); char[] C = sc.next().toCharArray(); String t = ""; for (int i = 4; i < C.length; i++) { t += C[i]; } BigDecimal dw = new BigDecimal(t);; // out.println(" " + C[3] + " dw = " + dw); if(C[3] == '+') { dw = dw.subtract(new BigDecimal(9)); } else { dw = BigDecimal.ZERO.subtract(dw).subtract(new BigDecimal(9)); } boolean f = true; if(dw.compareTo(BigDecimal.ZERO) < 0) { f = false; dw = BigDecimal.ZERO.subtract(dw); } int j = dw.intValue(); int m = dw.multiply(BigDecimal.TEN).intValue() - j * 10; // out.println(" dw = " + dw + " j = " + j + " m = " + m); m *= 6; // m / 10 * 60 // out.println(" --> m = " + m); if(f) { for (int i = 0; i < j; i++) A++; B += m; if(B >= 60) { B -= 60; A++;} if(A >= 24) A -= 24; } else { for (int i = 0; i < j; i++) A--; B -= m; if(B < 0) { B += 60; A--;} if(A < 0) A += 24; } out.println(String.format("%02d", A) + ":" + String.format("%02d", B)); } }