#include using namespace std; /////////////////// メイン /////////////////// int main () { //////////////////// 入力 //////////////////// int n, h, m, t; cin >> n >> h >> m >> t; //////////////// 出力変数定義 //////////////// //////////////////// 処理 //////////////////// m += t*(n-1); int tmp = m/60; m -= tmp*60; h += tmp; h %= 24; //////////////////// 出力 //////////////////// cout << h << endl; cout << m << endl; //////////////////// 終了 //////////////////// return 0; }