import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String h = scan.next(); String m = scan.next(); String t = scan.next(); scan.close(); int H; int M; double k; if(h.charAt(0) == '0') { H = Integer.parseInt(h.substring(1, 2)); }else { H = Integer.parseInt(h.substring(0, 2)); } if(m.charAt(0) == '0') { M = Integer.parseInt(m.substring(1, 2)); }else { M = Integer.parseInt(m.substring(0, 2)); } if(t.charAt(4) == '0') { k = Double.parseDouble(t.substring(3, t.length())); }else { k = Double.parseDouble(t.substring(3, t.length())); } SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); Date date = new Date(); try { String s = H + ":" + M; date = sdf.parse(s); }catch(ParseException e) { e.printStackTrace(); } int d = (int)Math.round(k * 60) - 540; Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.MINUTE, d); Date d1 = calendar.getTime(); System.out.println(sdf.format(d1)); } }