#include <bits/stdc++.h>
using namespace std;
long long c[105][105],vt[100000],n,tt=INT_MAX,s=0,d[100000];
void hv(long long i)
{
for (long long j=1;j<=n;j++)
{
if (d[j]==0)
{
vt[i]=j;
d[j]=1;
s+=c[vt[i]][vt[i-1]];
if (i==n)
tt=min(tt,s+c[vt[i]][1]);
else
hv(i+1);
d[j]=0;
s-=c[vt[i]][vt[i-1]];
}
}
}
int main() {
freopen("banhang.inp","r",stdin);
freopen("banhang.out","w",stdout);
cin>>n;
for (long long i=1;i<=n;++i)
for (long long j=1;j<=n;j++)
cin>>c[i][j];
vt[1]=1;
d[1]=1;
hv(2);
cout<<tt;
return 0;}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmxvbmcgbG9uZyBjWzEwNV1bMTA1XSx2dFsxMDAwMDBdLG4sdHQ9SU5UX01BWCxzPTAsZFsxMDAwMDBdOwp2b2lkIGh2KGxvbmcgbG9uZyBpKQp7CiAgZm9yIChsb25nIGxvbmcgaj0xO2o8PW47aisrKQogIHsKICAgICAgICBpZiAoZFtqXT09MCkKICAgICAgICB7CiAgICAgICAgICAgIHZ0W2ldPWo7CiAgICAgICAgICAgIGRbal09MTsKICAgICAgICAgICAgcys9Y1t2dFtpXV1bdnRbaS0xXV07CiAgICAgICAgaWYgKGk9PW4pCiAgICAgICAgICAgICAgICB0dD1taW4odHQscytjW3Z0W2ldXVsxXSk7CiAgICAgICAgZWxzZQogICAgICAgICAgICBodihpKzEpOwogICAgICAgIGRbal09MDsKICAgICAgICBzLT1jW3Z0W2ldXVt2dFtpLTFdXTsKICAgICAgICB9CiAgICAgIH0KfQoKaW50IG1haW4oKSB7CiAgICBmcmVvcGVuKCJiYW5oYW5nLmlucCIsInIiLHN0ZGluKTsKICAgIGZyZW9wZW4oImJhbmhhbmcub3V0IiwidyIsc3Rkb3V0KTsKICAgIGNpbj4+bjsKICAgIGZvciAobG9uZyBsb25nIGk9MTtpPD1uOysraSkKICAgICAgICBmb3IgKGxvbmcgbG9uZyBqPTE7ajw9bjtqKyspCiAgICAgICAgICAgIGNpbj4+Y1tpXVtqXTsKICAgIHZ0WzFdPTE7CiAgICBkWzFdPTE7CiAgICBodigyKTsKICAgIGNvdXQ8PHR0OwogICByZXR1cm4gMDt9Cg==