#include using namespace std; int i,j,i1,j1,A[110][110],R[110][110],C[110][110],SOL,sum,n; int main() { scanf("%d",&n); for(i=1;i<=n;i++) for(j=1;j<=n;j++) { scanf("%d",&A[i][j]); R[i][j]=R[i][j-1]+R[i-1][j]+R[i-1][j-1]+A[i][j]; } SOL=-50000000; for(i=1;i<=n;i++) for(j=1;j<=n;j++) for(int size=0;size<=n;size++) { if(i+size>n)break; if(j+size>n)break; sum=R[i+size][j+size]+R[i-1][j-1]-R[i+size][j-1]-R[i-1][j+size]-R[i+size-1][j+size-1]-R[i][j+size-1]-R[i+size-1][j]+R[i][j];\ if(sum>SOL)SOL=sum; } printf("%d\n",SOL); return 0; }