#include using namespace std; int main() { int N, H, M, T; cin >> N >> H >> M >> T; if (N == 1) { cout << H << endl; cout << M << endl; } int elapsed_min = (60 * H) + M; int waked_min = elapsed_min + ((N - 1) * T); cout << waked_min / 60 << endl; // hour cout << waked_min - (60 * (waked_min / 60)) << endl; }