#include <iostream>
using namespace std;
int main() {
int N, mat[51][51], sum = 0, sumMax = -250000;
cin >> N;
for (int i = 1; i <= N; ++i) {
for (int j = 1; j <= N; ++j) {
cin >> mat[i][j];
}
}
for (int j = N; j >= 1; --j) {
int row = 1, col = j;
while (row <= N && col <= N) {
sum += mat[row][col];
++row;
++col;
}
if (sum > sumMax) {
sumMax = sum;
}
sum = 0;
}
for (int i = 2; i <= N; ++i) {
int row = i, col = 1;
while (row <= N && col <= N) {
sum += mat[row][col];
++row;
++col;
}
if (sum > sumMax) {
sumMax = sum;
}
sum = 0;
}
for (int i = N - 1; i >= 1; --i) {
int row = 1, col = N - i;
while (row <= N - i && col <= N) {
sum += mat[row][col];
++row;
--col;
}
if (sum > sumMax) {
sumMax = sum;
}
sum = 0;
}
for (int i = 1; i <= N; ++i) {
int row = i, col = N;
while (row <= N && col <= N) {
sum += mat[row][col];
++row;
--col;
}
if (sum > sumMax) {
sumMax = sum;
}
sum = 0;
}
cout << sumMax;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CiAgICBpbnQgTiwgbWF0WzUxXVs1MV0sIHN1bSA9IDAsIHN1bU1heCA9IC0yNTAwMDA7CiAgICBjaW4gPj4gTjsKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IE47ICsraSkgewogICAgICAgIGZvciAoaW50IGogPSAxOyBqIDw9IE47ICsraikgewogICAgICAgICAgICBjaW4gPj4gbWF0W2ldW2pdOwogICAgICAgIH0KICAgIH0KICAgIGZvciAoaW50IGogPSBOOyBqID49IDE7IC0taikgewogICAgICAgIGludCByb3cgPSAxLCBjb2wgPSBqOwogICAgICAgIHdoaWxlIChyb3cgPD0gTiAmJiBjb2wgPD0gTikgewogICAgICAgICAgICBzdW0gKz0gbWF0W3Jvd11bY29sXTsKICAgICAgICAgICAgKytyb3c7CiAgICAgICAgICAgICsrY29sOwogICAgICAgIH0KICAgICAgICBpZiAoc3VtID4gc3VtTWF4KSB7CiAgICAgICAgICAgIHN1bU1heCA9IHN1bTsKICAgICAgICB9CiAgICAgICAgc3VtID0gMDsKICAgIH0KICAgIGZvciAoaW50IGkgPSAyOyBpIDw9IE47ICsraSkgewogICAgICAgIGludCByb3cgPSBpLCBjb2wgPSAxOwogICAgICAgIHdoaWxlIChyb3cgPD0gTiAmJiBjb2wgPD0gTikgewogICAgICAgICAgICBzdW0gKz0gbWF0W3Jvd11bY29sXTsKICAgICAgICAgICAgKytyb3c7CiAgICAgICAgICAgICsrY29sOwogICAgICAgIH0KICAgICAgICBpZiAoc3VtID4gc3VtTWF4KSB7CiAgICAgICAgICAgIHN1bU1heCA9IHN1bTsKICAgICAgICB9CiAgICAgICAgc3VtID0gMDsKICAgIH0KICAgIGZvciAoaW50IGkgPSBOIC0gMTsgaSA+PSAxOyAtLWkpIHsKICAgICAgICBpbnQgcm93ID0gMSwgY29sID0gTiAtIGk7CiAgICAgICAgd2hpbGUgKHJvdyA8PSBOIC0gaSAmJiBjb2wgPD0gTikgewogICAgICAgICAgICBzdW0gKz0gbWF0W3Jvd11bY29sXTsKICAgICAgICAgICAgKytyb3c7CiAgICAgICAgICAgIC0tY29sOwogICAgICAgIH0KICAgICAgICBpZiAoc3VtID4gc3VtTWF4KSB7CiAgICAgICAgICAgIHN1bU1heCA9IHN1bTsKICAgICAgICB9CiAgICAgICAgc3VtID0gMDsKICAgIH0KICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IE47ICsraSkgewogICAgICAgIGludCByb3cgPSBpLCBjb2wgPSBOOwogICAgICAgIHdoaWxlIChyb3cgPD0gTiAmJiBjb2wgPD0gTikgewogICAgICAgICAgICBzdW0gKz0gbWF0W3Jvd11bY29sXTsKICAgICAgICAgICAgKytyb3c7CiAgICAgICAgICAgIC0tY29sOwogICAgICAgIH0KICAgICAgICBpZiAoc3VtID4gc3VtTWF4KSB7CiAgICAgICAgICAgIHN1bU1heCA9IHN1bTsKICAgICAgICB9CiAgICAgICAgc3VtID0gMDsKICAgIH0KICAgIGNvdXQgPDwgc3VtTWF4OwogICAgcmV0dXJuIDA7Cn0=