#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define two(x) (1<<(x-1))
using namespace std;
#define N 20
int n,m,w[N][N],f[(1<<16)+10][N],p[(1<<16)+10],ans;
int main(){
	scanf("%d%d",&n,&m);int Max=(1<<n)-1;
	rep (i,1,m){
		int x,y,z;scanf("%d%d%d",&x,&y,&z);
		ans+=z;w[x][y]=w[y][x]=z;
	}
	p[0]=0;
	rep (i,1,Max){
		int now;
		rep (j,1,n) if (i>>j-1&1){now=j;break;}
		p[i]=p[i^(1<<now-1)];
		rep (j,1,n) if (i>>j-1&1) p[i]+=w[now][j];
	}
	memset(f,0xc0,sizeof(f));
	f[1][1]=0;
	int tmp=-1e9;
	rep (s,1,Max) rep (i,1,n){
		for (int t=s;t;t=(t-1)&s)
			if (t>>i-1&1)
				f[s][i]=max(f[s][i],f[(s-t)|(1<<i-1)][i]+p[t]);
        rep (j,1,n)
			if (!(s>>j-1&1)&&w[i][j])
				f[s|(1<<j-1)][j]=max(f[s|(1<<j-1)][j],f[s][i]+w[i][j]);
	}
	ans-=f[Max][n];
	printf("%d\n",ans);
	return 0;
}