#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
const int inf=999999999;
int n;
int city[20][20];
int ans=inf;
bool ju[20]={0};
bool jud[20][20];
void dfs(int a,int num,int t)
{
if(t>ans||num>n) return;
if(num==n&&a==0)
{
ans=min(ans,t);
return;
}
for(int i=0;i<=n;i++)
{
if(a!=i&&!jud[a][i])
{
if(!ju[i])
{
ju[i]=1;
jud[a][i]=1;
dfs(i,num+1,t+city[a][i]);
ju[i]=0;
jud[a][i]=0;
}
else
{
jud[a][i]=1;
dfs(i,num,t+city[a][i]);
jud[a][i]=0;
}
}
}
}
int main()
{
cin>>n;
for(int i=0;i<=n;i++)
{
for(int j=0;j<=n;j++)
{
cin>>city[i][j];
}
}
ju[0]=1;
dfs(0,0,0);
cout<<ans<<endl;
return 0;
}