#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef pair pii; typedef vector vll; typedef vector vi; typedef vector> vvi; typedef vector> vvll; const ll inf = 1e16; const ll md = 1000000007; int main() { int n,h,m,t; cin>>n>>h>>m>>t; int hm=h*60+m+(n-1)*t; h=hm/60; m=hm%60; if(h>23) h%=24; cout<