#include <cstddef>
#include <fstream>
#include <iostream>
using namespace std;
int main(){
int a,b,c,d;
int e,f,g;
cin>>a>>b>>c>>d;
g=c+d%60-(c+d%60)/6060;
f=b+d/60+(c+d%60)/60-(b+d/60+(c+d%60)/60)/6060;
e=a+(b+d/60+(c+d%60)/60)/60;
cout<<e<<" "<<f<<" "<<g;
}