#include <iostream>
using namespace std;

class Time {

    public:
        int hours;      // 小时
        int minutes;    // 分钟

        Time() {
            hours = 0;
            minutes = 0;
        }

        Time(int h, int m) {
            this->hours = h;
            this->minutes = m;
        }

        void show() {
            cout << hours << " " << minutes << endl;
        }

        // write your code here......
        Time operator+(Time &t2)
        {
            Time t;
            int sum_hours=0,sum_minutes=0;
            int t1_minutes=this->hours*60+this->minutes;
            int t2_minutes=t2.hours*60+t2.minutes;
            int add_minutes=t1_minutes+t2_minutes;
            sum_hours=add_minutes/60;
            sum_minutes=add_minutes%60;
            t.hours=sum_hours;
            t.minutes=sum_minutes;

            return t;


        }

};

int main() {

    int h, m;
    cin >> h;
    cin >> m;

    Time t1(h, m);
    Time t2(2, 20);

    Time t3 = t1 + t2;
    t3.show();
    
    return 0;
}