#include<iostream>
#include<cstdio>
#define MAX 105
#define INFTY (1<<21)
using namespace std;

void matrixmax(int n, int a[MAX][MAX]) {
    int S[n][n][n], T[n][n];
    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < n; j++ ) {
            for ( int k = 1; k < n - j + 1; k++ ) {
                if ( k == 1 ) {
                    S[i][j][k] = a[i][j];
                    continue;
                }
                S[i][j][k] = S[i][j][k - 1] + a[i][j + k - 1];
            }
        }
    }
    for ( int j = 0; j < n; j++ ) {
        for ( int k = 1; k < n - j + 1; k++ ) {
            int s[n], maxs = -INFTY;
            for ( int l = 0; l < n; l++ ) {
                if ( l == 0 ) {
                    s[l] = S[0][j][k];
                    continue;
                }
                s[l] = max(S[l][j][k], S[l][j][k] + s[l - 1]);
            }
            for ( int l = 0; l < n; l++ ) maxs = max(maxs, s[l]);
            T[j][k] = maxs;
        }
    }
    int maxt = -INFTY;
    for ( int j = 0; j < n; j++ ) {
        for ( int k = 1; k < n - j + 1; k++ ) {
            maxt = max(maxt, T[j][k]);
        }
    }
    cout << maxt << endl;
}

int main() {
    int n;
    cin >> n;
    int a[MAX][MAX];
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++) scanf("%d", &a[i][j]);
    }
    matrixmax(n, a);
    return 0;
}
