Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/if-smena-davomiyligi

Shift length

Medium 1000 ms 64 MB 40%
Share

A shift starts at $h_{1}$ hours $m_{1}$ minutes and ends at $h_{2}$ hours $m_{2}$ minutes ($24$-hour time). If the end time is earlier than the start time, the shift goes past midnight and ends the next day. A shift lasts less than a day. Find how many hours and minutes the shift lasts.

The shift length between the start and end times

Input

One line with four integers: $h_{1}$, $m_{1}$, $h_{2}$ and $m_{2}$.

Output

One line with two integers: the number of hours and the number of minutes (from $0$ to $59$).

Note

$0 \le h_{1}, h_{2} \le 23$
$0 \le m_{1}, m_{2} \le 59$
The start and end times are different.

Examples

Input #1
9 0 18 30
Output #1
9 30
Input #2
22 15 6 0
Output #2
7 45

Sign in to submit a solution

Signing up is free and takes a minute.