#C499. Aggregate Time Intervals

    ID: 48588 Type: Default 1000ms 256MiB

Aggregate Time Intervals

Aggregate Time Intervals

Given a list of time intervals in the format hh:mm, your task is to compute the total time by summing up all the intervals. The result should be displayed in the format "hh hours, mm minutes".

For example, if the input intervals are 01:20, 02:35, 00:50, and 01:15, the total time is calculated as follows:

$$\text{Total Minutes} = 1 \times 60 + 20 + 2 \times 60 + 35 + 0 \times 60 + 50 + 1 \times 60 + 15$$

This gives a final output of 6 hours, 0 minutes.

inputFormat

The first line contains an integer n representing the number of time intervals. The following n lines each contain a time interval in hh:mm format.

Example:

4
01:20
02:35
00:50
01:15

outputFormat

Output the total aggregated time in the format hh hours, mm minutes.

Example:

6 hours, 0 minutes
## sample
4
01:20
02:35
00:50
01:15
6 hours, 0 minutes