#include "bits/stdc++.h" using namespace std; int main(){ int n,h,m,t; cin >> n >>h >>m >>t; int hour=h,minute; minute=m+((n-1)*t); while(minute>=60){ hour++; minute-=60; } hour%=24; cout <