#include <iostream>

using namespace std;

int main() {

    int hour, min, sec, totalHours=0, totalMins=0, totalSecs=0;
    int counter, intervals;

    cout << "Enter number of time intervals you have: ";
    cin >> intervals;
    
    counter = 1;
    while (counter <= intervals) {
        cout << "Enter: hour min sec >  ";
        cin >> hour >> min >> sec;
        
        totalHours += hour;
        totalMins += min;
        totalSecs += sec;
        
        counter++;
    }
    
    cout << totalHours << "  " << totalMins << "  " << totalSecs << endl;
 
    totalMins += totalSecs / 60;
    totalSecs = totalSecs % 60;
    
    totalHours += totalMins / 60;
    totalMins = totalMins % 60;
    
    cout << totalHours << "  " << totalMins << "  " << totalSecs << endl;
          
        
        
    system("pause");
}


