#include <iostream>

using namespace std;

int main() {
    int h = 0, m = 0, s = 0;
    int time = 0;

    cin >> h >> m >> s;
    cin >> time;

    s += time;
    m += s / 60;
    s %= 60;

    h += m / 60;
    m %= 60;
    h %= 24;

    cout << h << " " << m << " " << s;

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: