#include using namespace std; int v[55][55],a[55][55]; int main(){ int n,rasp,pat,lat,sum; scanf("%d",&n); for(register int i=1;i<=n;++i){ for(register int j=1;j<=n;++j){ scanf("%d",&v[i][j]); a[i][j]=v[i][j]; v[i][j]+=v[i-1][j]; } } rasp=v[1][1]; for(register int i1=1;i1<=n;++i1){ for(register int i2=i1;i2<=n;++i2){ pat=n-(i2-i1+1)+1; lat=i2-i1-1; for(register int k=1;k<=pat;++k){ sum=(v[i2][k]-v[i1-1][k])+(v[i2][k+lat+1]-v[i1-1][k+lat+1]); for(register int j=1;j<=lat;++j){ sum=sum+(a[i1][k+j]+a[i2][k+j]); } if(sum>rasp){ rasp=sum; } } } } printf("%d\n",rasp); return 0; }