#include #define mod 1000000007 using namespace std; int main() { int N,H,M,T;scanf("%d %d %d %d",&N,&H,&M,&T); int minsum=(N-1)*T; int hplus=minsum/60;int minplus=minsum-hplus*60; H+=hplus,M+=minplus; H+=M/60;M%=60; H%=24; printf("%d\n%d\n",H,M); }