#include<cstdio>
#include<cstring>
#include<algorithm>
#define MN 16
using namespace std;
inline int in(){
    int x=0;bool f=0; char c;
    for (;(c=getchar())<'0'||c>'9';f=c=='-');
    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');
    return f?-x:x;
}
int f[1<<MN][MN],sum[1<<MN],mp[MN][MN];
int n,m,a,b,c;
int main()
{
	n=in();m=in();
	for (int i=1;i<=m;++i){
		a=in()-1;b=in()-1;c=in();
		mp[a][b]=mp[b][a]=c;
	}memset(f,-0X3F,sizeof(f));f[1][0]=0;
	for (int s=0;s<(1<<n);++s)
	for (int i=0;i<n;++i) if (s&(1<<i))
	for (int j=i+1;j<n;++j) if (s&(1<<j)) sum[s]+=mp[i][j];
	for (int s=0;s<(1<<n);++s)
	for (int i=0;i<n;++i) if (s&(1<<i)){
		for (int j=0;j<n;++j)
		if (!(s&(1<<j))&&mp[i][j])
		f[s|(1<<j)][j]=max(f[s|(1<<j)][j],f[s][i]+mp[i][j]);
		int r=((1<<n)-1)-s;
		for (int t=r;t;t=((t-1)&r)) f[s|t][i]=max(f[s|t][i],f[s][i]+sum[t+(1<<i)]);
	}
	printf("%d",sum[(1<<n)-1]-f[(1<<n)-1][n-1]);return 0;
}