#include using namespace std; using ll = long long; using pii = pair; using pll = pair; using vi = vector; using vl = vector; using vs = vector; #define endl ('\n') inline vector range(int64_t stop){vectorv(stop);iota(v.begin(),v.end(),0LL);return v;} inline vector range(int64_t start,int64_t stop){vectorv(stop-start);iota(v.begin(),v.end(),start);return v;} inline vector range(int64_t start,int64_t stop,int64_t step){int s=step>0?(stop-start+step-1)/step:(stop-start+step+1)/step;if(s<=0)return {};vectorv(s);for(int i=0;i> n >> h >> m >> t; int a = h*60+m; for(auto i:range(n-1)){ a += t; if(a>=1440)a-=1440; } h = a/60; m = a%60; cout << h << endl << m << endl; }