//(仅供借(chao)鉴(xi))(当然你要抄袭我也没办法)
#include<iostream>
#include<cstdio>
using namespace std;
int a[205][205],n,m,ans=-1e9;
int main()
{
freopen("lepr.in","r",stdin);
freopen("lepr.out","w",stdout);
scanf("%d",&n);
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
scanf("%d",&a[i][j]);
for (int i=1;i<=n;i++)
{
for (int j=1;j<=n;j++)
{
int cnt=0;
for (int k=0;k<n;k++)
{
int x=(j+k)%n;
if (x==0) x=n;
if (cnt+a[i][x]>a[i][x]) cnt+=a[i][x];
else cnt=a[i][x];
ans=max(ans,cnt);
}
}
}
for (int i=1;i<=n;i++)
{
for (int j=1;j<=n;j++)
{
int cnt=0;
for (int k=0;k<n;k++)
{
int x=(j+k)%n;
if (x==0) x=n;
if (cnt+a[x][i]>a[x][i]) cnt+=a[x][i];
else cnt=a[x][i];
ans=max(ans,cnt);
}
}
}
for (int i=1;i<=n;i++)
{
for (int j=1;j<=n;j++)
{
int cnt=0;
for (int k=0;k<n;k++)
{
int x=(i+k)%n;
int y=(j+k)%n;
if (x==0) x=n;
if (y==0) y=n;
if (cnt+a[x][y]>a[x][y]) cnt+=a[x][y];
else cnt=a[x][y];
ans=max(ans,cnt);
}
}
}
for (int i=1;i<=n;i++)
{
for (int j=1;j<=n;j++)
{
int cnt=0;
for (int k=0;k<n;k++)
{
int x=(i-k+n)%n;
int y=(j+k)%n;
if (x==0) x=n;
if (y==0) y=n;
if (cnt+a[x][y]>a[x][y]) cnt+=a[x][y];
else cnt=a[x][y];
ans=max(ans,cnt);
}
}
}
printf("%d\n",ans);
return 0;
}