#include<cstdio>
#include<iostream>
#define For(a,b,c,d) for(int d=a;d<=b;d+=c)
using namespace std;
int n,s=-0e7,a[2002][2002],f[2002],b[2002];
int main() {
cin>>n;
For(1,n,1,i) {
For(1,n,1,j) {
scanf("%d",a+i+j);
}
}
For(1,n,1,i) {
For(i,n,1,j) {
For(1,n,1,k) {
b[k]+=a[j][k];
}
For(1,n,1,k) {
f[k]=max(f[i-1]+b[k],b[k]);
s=max(s,f[k]);
}
}
For(1,n,1,k) {
f[k]=0;
}
}
printf("%d",s);
return 0;
}