Late Larry

시간 제한1초메모리 제한2048 MB

요약
12시간 형식의 약속 시각과 이동 시간(분)이 주어질 때, 래리가 출발해야 하는 시각을 12시간 형식으로 출력한다.
난이도

쉬움10점 중 2점

유형
수학, 구현
정답자
아직 제출이 없습니다

문제

Larry is a hard-working and honest programmer, who has been one of the most productive engineers in his company. His bosses are even looking to promote him... but there is a problem: Larry is always late. Larry's bosses recently told him that if he does not improve his promptness he will not be promoted.

Larry asks you to help him get to his appointments on time. He tells you that he never knows when to leave for meetings and appointments, though he admits he always knows how many minutes it will take to get to the meeting. Luckily he never has to travel more than 2424 hours from where he is for a meeting; however, if the meeting is far away, he may have to leave the day before to arrive at his meeting on time.

입력

  • The first line contains the scheduled time of the meeting.

    The scheduled meeting time is in the format "hh:mm dd", where hh is the hour of the day (1≤h≤121\leq h\leq 12) and mm is the number of minutes (0≤m<600 \leq m < 60). mm (an integer) is always given as two digits (i.e., left-padded with zeros), but hh (also an integer) is not left-padded with zeros if it is only one digit. Finally dd is either "AM" or "PM".

  • The second line contains the time it takes Larry to arrive at the meeting. This time is an integer number of minutes tt (1≤t≤1440=24\*601\leq t \leq 1440 = 24\*60).

출력

Output the time Larry will need to leave in order to make his appointment or meeting on time. The output should be in the format "hh:mm dd" (like the input), where hh is the hour of the day (1≤h≤121\leq h\leq 12) and mm is the number of minutes (0≤m<600 \leq m < 60). mm (an integer) is always given as two digits (i.e.,\ left-padded with zeros) but hh (also an integer) is not left-padded with zeros. Finally dd should be "AM" or "PM".

예제2

  1. 예제 1

    입력
    4:30 PM
    52
    
    예상 출력
    3:38 PM
    
  2. 예제 2

    입력
    12:22 PM
    88
    
    예상 출력
    10:54 AM