#include #include #include #include #include #define rep(i,n) for(i=0; i> a #define out(a,b) cout << a << b using namespace std; using lint = long long; int main(void){ int i, j, n, m, k, cnt = 0; int h, t; in(n); in(h); in(m); in(t); int init = h*60+m; int tot = init+(n-1)*t; out((tot/60)%24,endl); out(tot%60,endl); return 0; }