#include<iostream> using namespace std; int main() { int n,gold,silv,bron,G,S,B,T; G=0; S=0; B=0; cin>>n; while(n--){ cin>>gold>>silv>>bron; G+=gold; S+=silv; B+=bron; } T=G+B+S; cout<<G<<" "<<S<<" "<<B<<" "<<T; return 0; }