#include <iostream>
using namespace std;
int main()
{
int n, j, y, t, jz = 0, yz = 0, tz = 0;
cin >> n;
while (n--)
{
cin >> j >> y >> t;
jz += j;
yz += y;
tz += t;
}
cout << jz << " " << yz << " " << tz << " " << jz + yz + tz;
return 0;
}