#include <bits/stdc++.h>
using namespace std;
const int N=500+5;
long long n,a[N][N],g[2][N][N],f[N][N],cnt,sum=0x3f3f3f3f3f3f3f3f;
void init(){
	scanf("%lld",&n);
	for(int i=0;++i<=n;) for(int j=0;++j<=n;i==j?:scanf("%lld",&a[i][j]));
}
long long gg(int k,int lx,int ly,int rx,int ry){
	return g[k][rx][ry]-g[k][lx-1][ry]-g[k][rx][ly-1]+g[k][lx-1][ly-1];
}
void work(){
	for(int i=0;++i<=n;){
		for(int j=0;++j<=n;i>=j?:g[0][i][j]=a[i][j],g[0][i][j]+=g[0][i][j-1]);
		for(int j=0;++j<=n;g[0][i][j]+=g[0][i-1][j]);
	}
	for(int i=0;++i<=n;){
		for(int j=0;++j<=n;i<=j?:g[1][i][j]=a[i][j],g[1][i][j]+=g[1][i][j-1]);
		for(int j=0;++j<=n;g[1][i][j]+=g[1][i-1][j]);
	}
	memset(f,0x3f,sizeof(f));
	f[0][0]=0;
	for(int i=-1;++i<=n;) for(int j=-1;++j<max(i,1);) for(int h=i;++h<=n;
		cnt=f[i][j]+gg(1,h+1,j+1,n,i)+gg(0,i+1,i+1,h,h),f[h][i]=min(f[h][i],cnt));
	for(int i=0;++i<=n;sum=min(sum,f[n][i]));
}
void prin(){
	printf("%lld",sum);
}
int main(){
	init();
	work();
	prin();
	return 0;
}