An airline's screen shows when a flight lands in local time at the destination. Read four lines:
- the departure time on the local clock,
HH:MM(24-hour), - the departure city's time zone,
- the flight duration,
- the arrival city's time zone.
A time zone is written UTC, optionally followed by a sign and an offset: UTC, UTC+1,
UTC-5, UTC+05:30, UTC-3:30, UTC+14. The hours may have one or two digits; :MM is
optional. UTC-3:30 means three and a half hours behind UTC.
A duration is hours followed by h and/or minutes followed by m, with no spaces: 7h55m,
12h, 45m, 0h90m. Minutes are not limited to 59.
Print one line:
Arrives HH:MM (<day note>)
where the day note compares the arrival's local date with the departure's local date:
same day, +1 day, +N days for N >= 2, -1 day, or -N days for N >= 2.
Examples
Input:
22:15
UTC-5
7h55m
UTC+1
Output:
Arrives 12:10 (+1 day)
Input:
06:00
UTC+10
2h30m
UTC-10
Output:
Arrives 12:30 (-1 day)
Constraints
- Offsets lie between
UTC-12andUTC+14; offset minutes are00,30or45. - The duration is between
1mand99h59min total. - Lines have no surrounding spaces.
Goals
- Parse times, time-zone offsets and durations written in several forms
- Do all clock arithmetic in whole minutes and convert back only at the end
- Use floor division and modulo correctly with negative totals