#include <bits/stdc++.h>
using namespace std;

#define LL long long

const int maxN=505;

int n;
LL f[maxN+1][maxN+1],A[maxN+1][maxN+1],s1[maxN+1][maxN+1],s2[maxN+1][maxN+1];

inline LL read()
{
	LL num=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))num=(num<<3)+(num<<1)+(ch^48),ch=getchar();
	return num*f;
}

inline LL query(int xu,int yu,int xd,int yd,LL sum[maxN+1][maxN+1])
{
	return sum[xd][yd]-sum[xu-1][yd]-sum[xd][yu-1]+sum[xu-1][yu-1];
}

int main()
{

	n=read();
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
			if(i!=j)A[i][j]=read();
			s1[i][j]=s1[i-1][j]+s1[i][j-1]-s1[i-1][j-1];
			s2[i][j]=s2[i-1][j]+s2[i][j-1]-s2[i-1][j-1];
			if(i<j)s1[i][j]+=A[i][j];
			if(i>j)s2[i][j]+=A[i][j];
		}
	
	for(int i=1;i<=n-1;i++)
	{
		f[i][0]=query(1,1,i+1,i,s2);
		for(int j=0;j<i;j++)
		{
			f[i][i]=max(f[i][i],f[i-1][j]+query(i+1,j+1,i+1,i,s2)+query(1,i+1,i,i+1,s1));
			for(int k=0;k<j;k++)
				f[i][j]=max(f[i][j],f[j-1][k]+query(j+1,k+1,i+1,i,s2)+query(1,j+1,j,i+1,s1));
		}
	}

	LL ans=0;
	for(int i=0;i<=n-1;i++)ans=max(ans,f[n-1][i]);
	printf("%lld",s1[n][n]+s2[n][n]-ans);
}
