import java.util.Scanner; import java.util.Arrays; import java.util.Deque; import java.util.ArrayDeque; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); String c = sc.next(); c = c.replaceAll("UTC", ""); double C = Double.parseDouble(c); C = C - 9; a = (int) (a + C * 100 / 100); b = (int) (b + (C * 100 % 100) * 0.6); if (b < 0) { b = 60 + b; a = a - 1; } if (b >= 60) { b = b - 60; a = a + 1; } if (a >= 24) { a = a - 24; } if (a < 0) { a = a + 24; } System.out.println(a / 10 + "" + a % 10 + ":" + b / 10 + "" + b % 10 + ""); } }