import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); String s = sc.next().substring(3); double zisa; int allMinute; if(s.charAt(0) == '+') { zisa = Double.valueOf(s.substring(1)) - 9.0; allMinute = (int)(24 * 60 * 60.0 + zisa * 60.0 + a * 60.0 + b * 1.0) % (24 * 60 * 60); } else { zisa = Double.valueOf(s.substring(1)) + 9.0; allMinute = (int)(24 * 60 * 60.0 - zisa * 60.0 + a * 60.0 + b * 1.0) % (24 * 60 * 60); } System.out.printf("%02d:%02d", allMinute / 60 % 24, allMinute % 60); } }