#include int main() { int h, m, s, time; scanf("%d %d %d",&h, &m, &s); scanf("%d",&time); h += time / 3600; time %= 3600; m += time / 60; time %= 60; s += time; if (s >= 60) { m += s/60; s %= 60; } if (m >= 60) { h += m/60; m %= 60; } if (h >= 24) h %= 24; printf("%d %d %d\n",h, m, s); return 0; }