#include using namespace std; int main() { int n,h,m,t; cin >> n >> h >> m >> t; for(int i = 1; i < n; i++) { int th = t / 60; int tm = t % 60; m += tm; if(m >= 60) { h += 1; m -= 60; } h += th; if(h > 23) { h -= 24; } } cout << h << endl << m; }