#include<cstdio>
using namespace std;

int n;
int S[110][110] = { 0 };
int sum = -100000;

int main(){
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= n; j++){
			scanf("%d", &S[i][j]);
			S[i][j] += (S[i][j-1]+S[i-1][j]-S[i-1][j-1]);
		}
	}
	for (int a = 1; a <= n; a++){
		for (int b = 1; b <= n; b++){
			for (int c = 0; c < a; c++){
				for (int d = 0; d < b; d++){
					int t = S[a][b] - S[a][d] - S[b][c] + S[c][d];
					if (sum < t)sum = t;
				}
			}
		}
	}
	printf("%d\n", sum);
}