#K51117. Activity Time Summation

    ID: 29017 Type: Default 1000ms 256MiB

Activity Time Summation

Activity Time Summation

You are given several datasets recording daily activity intervals. Each dataset begins with an integer n representing the number of activity intervals followed by n lines. Each line contains two times in HH:MM format representing the start and end time of an activity. The input terminates with a line containing 0, which indicates that there are no more datasets.

Your task is to compute the total duration in minutes for each dataset. For each activity interval, the duration is calculated as:

$$\text{duration} = (\text{end time in minutes}) - (\text{start time in minutes}). $$

Output the total minutes for each dataset on a new line.

inputFormat

The input is provided via stdin and consists of multiple datasets. Each dataset is defined as follows:

  • An integer n on a line indicating the number of activity intervals. If n is 0, it marks the end of input.
  • n subsequent lines each contain two times in the format HH:MM HH:MM representing the start and end times of an activity.

All times are in 24-hour format.

outputFormat

For each dataset, output a single line to stdout containing the total duration (in minutes) computed by summing the minutes of each activity interval in that dataset.

## sample
3
08:00 09:30
10:15 11:45
13:00 14:30
2
09:00 10:30
11:15 12:45
0
270

180

</p>