//dp问题,不算太难
//写好之后一直不过,原因就是在第一列的初始化时,没有处理好。。。
#include<iostream>
using namespace std;
int main()
{
int a[110][110],i,j,k,sum,max=-10000,s[110][110];
int n,temp;
while(scanf("%d",&n)!=EOF)
{
memset(s,0,sizeof(s[0][0]));
for(i=0;i<n;++i)
for(j=1;j<=n;++j)
{
scanf("%d",&a[i][j-1]);
s[i][j]=s[i][j-1]+a[i][j-1];
}
for(i=0;i<n;++i)
for(j=i;j<n;++j)
{
sum=0;
for(k=0;k<n;++k)
{
temp=s[k][j]-s[k][i];
sum+=temp;
if(sum<0) sum=0;
else if(sum>max)
max=sum;
}
}
printf("%d\n",max);
}
return 1;
}
using namespace std;
int main()
{
int a[110][110],i,j,k,sum,max=-10000,s[110][110];
int n,temp;
while(scanf("%d",&n)!=EOF)
{
memset(s,0,sizeof(s[0][0]));
for(i=0;i<n;++i)
for(j=1;j<=n;++j)
{
scanf("%d",&a[i][j-1]);
s[i][j]=s[i][j-1]+a[i][j-1];
}
for(i=0;i<n;++i)
for(j=i;j<n;++j)
{
sum=0;
for(k=0;k<n;++k)
{
temp=s[k][j]-s[k][i];
sum+=temp;
if(sum<0) sum=0;
else if(sum>max)
max=sum;
}
}
printf("%d\n",max);
}
return 1;
}