#include <fstream>

using namespace std;

int main()
{
	ifstream input("MATRANVUONG.inp");
	ofstream output("MATRANVUONG.out");
	int n;
	double tong1 = 0, tong2 = 0, tong3 = 0, tong4 = 0, tong5 = 0, tong6 = 0, tong7  = 0, tong8 = 0;
	input >> n;
	double a[n][n];
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			input >> a[i][j];
			if (i == j) tong1 += a[i][j];
			if (i + j == n - 1) tong2 += a[i][j];
			if (i + 1 == j) tong3 += a[i][j];
			if (i + j == n - 2) tong5 += a[i][j];
			if (i < j) tong7 += a[i][j];
			if (i + j >= n) tong8 += a[i][j];
		}
	}
	output << tong1 << '\n' << tong2 << '\n' << tong3 << '\n' << tong5 << '\n' << tong7 << '\n' << tong8;
	return 0;
}
