#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;
        }

        // 输出两个 Time 对象(t1 和 t2)相加后的时间结果
        //重载加号运算符
        // Time operator + (Time &t){
        //     hours = (hours + t.hours + (minutes + t.minutes)/60)%24;
        //     minutes = (minutes + t.minutes)%60;
        //     return *this;
        // }
        Time operator + (Time &t){
            hours = (hours + t.hours + (minutes + t.minutes)/60)%24;
            minutes = (minutes + t.minutes)%60;
            return Time(hours,minutes);
        }

};

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;
}