#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int e[15][15];
int n;
int dp1[1<<15];
int dp2[1<<15][15];
int tmp[15];
void upd(int&x,int y){
	if(x==-1 || x<y)x=y;
}
int main(){
	int m, tot = 0;
	scanf("%d%d",&n,&m);
	while(m--){
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		--x;--y;
		e[x][y] = e[y][x] = z;
		tot += z;
	}
	for(int mask=1; mask < (1<<n); mask ++){
		int t;
		for(t=0; (mask&(1<<t)) == 0; t++);
		dp1[mask] = dp1[mask-(1<<t)];
		for(int i=t+1; i<n; i++)if(mask&(1<<i))
			dp1[mask] += e[t][i];
	}
	memset(dp2,-1,sizeof(dp2));
	for(int mask=1; mask < (1<<n); mask++)if((mask&1)!=0&&(mask&(1<<(n-1)))==0)
		dp2[mask][0] = dp1[mask];

	for(int mask=1; mask < (1<<n); mask++){
		memset(tmp,-1,sizeof(tmp));
		for(int i=0; i<n; i++)if((mask&(1<<i))!=0 && dp2[mask][i] != -1)
		for(int j=0; j<n; j++)if((mask&(1<<j)) == 0 && e[i][j] != 0)
			upd(tmp[j], dp2[mask][i] + e[i][j]);
		int comp = (1<<n) - 1 - mask, b = 0;
		do{
			for(int i=0; i<n; i++)if((b & (1<<i))!=0 && tmp[i]!=-1){
				upd(dp2[mask + b][i], tmp[i] + dp1[b]);
			}
		}while(b=(b-comp)&comp);
	}
	printf("%d\n",tot - dp2[(1<<n)-1][n-1]);
	return 0;
}