#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
cout<<n/86400<<" "<<(n%86400)/3600<<" "<<((n%86400)%3600)/60<<" "<<n%60;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbjsKCWNpbj4+bjsKCWNvdXQ8PG4vODY0MDA8PCIgIjw8KG4lODY0MDApLzM2MDA8PCIgIjw8KChuJTg2NDAwKSUzNjAwKS82MDw8IiAiPDxuJTYwOwoJcmV0dXJuIDA7Cn0=