import java.io.*; import java.util.*; public class Main_yukicoder652 { private static Scanner sc; private static Printer pr; private static void solve() { int a = sc.nextInt(); int b = sc.nextInt(); String s = sc.next(); int sign = s.charAt(3) == '+' ? 1 : -1; int c = s.indexOf('.'); if (c == -1) { c = s.length(); } int tz = Integer.parseInt(s.substring(4, c)) * 10; if (c < s.length()) { tz += Integer.parseInt(s.substring(c + 1, s.length())); } tz *= sign; a = (a - 9 + 24) % 24; int jp = a * 60 + b; jp *= 10; int sq = (jp + tz * 60 + 60 * 24 * 10) % (60 * 24 * 10); sq /= 10; pr.printf("%02d:%02d\n", sq / 60, sq % 60); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }