#include <stdio.h>
int main ()
{
int a,b,c,d,i,j= 0,f,l=0,k;
scanf("%d %d %d %d",&a,&b,&c,&f);
d =(a * 60 * 60) + (b *60) + c+ f;
k =(a * 60 * 60) + (b *60) + c+ f;
d = d % (1440 * 60);
k = k % (60 * 60);
i = d / 3600;
j = k / 60 ;
l = d % 60;
printf("%d %d %d",i,j,l);
return 0;
}