#include <bits/stdc++.h>
using namespace std;
int x, y, z, h;
int main() {
int n, a, b, c;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a >> b >> c;
x = x + a;
y = y + b;
z = z + c;
}
h = x + y + z;
cout << x << " " << y << " " << z << " " << h;
return 0;
}