#P1425. Swimming Duration

    ID: 14711 Type: Default 1000ms 256MiB

Swimming Duration

Swimming Duration

In this problem, you are given the start time and end time of Little Fish's swimming session, recorded in a $24$-hour format. Specifically, the session starts at $a$ hours and $b$ minutes, and ends at $c$ hours and $d$ minutes on the same day. Your task is to calculate the total duration of the swimming session in minutes.

Note: It is guaranteed that the end time is not earlier than the start time.

inputFormat

The input consists of four space-separated integers:

  • a: the starting hour (0 ≤ a ≤ 23)
  • b: the starting minute (0 ≤ b ≤ 59)
  • c: the ending hour (0 ≤ c ≤ 23)
  • d: the ending minute (0 ≤ d ≤ 59)

All times are given in a $24$-hour format.

outputFormat

Output a single integer, which is the total duration of the swimming session in minutes. The duration is computed as:

$$\text{duration} = (c \times 60 + d) - (a \times 60 + b)$$

sample

10 30 11 30
60