#include <bits/stdc++.h>
using namespace std;
int n,m,edge[20][20];
long long ans=0,sum[1<<16],dp[1<<16][20];
int main(){
	scanf("%d %d",&n,&m);
	for(int i=1,u,v,w;i<=m;i++){
		scanf("%d %d %d",&u,&v,&w);
		edge[u][v]=edge[v][u]=w;
		ans+=w;
	}
	int tmp=(1<<n);
	for(int S=0;S<tmp;S++){
		for(int i=1;i<=n;i++){
			dp[S][i]=-1;
			if(!(S&(1<<(i-1)))&&!sum[S|(1<<(i-1))]){
				sum[S|(1<<(i-1))]=sum[S];
				for(int j=1;j<=n;j++){
					if(S&(1<<(j-1))) sum[S|(1<<(i-1))]+=edge[i][j];
				}
			}
		}
	}
	dp[1][1]=0;
	for(int S=0;S<tmp;S++){
		for(int i=1;i<=n;i++){
			if(dp[S][i]<0) continue;
			if(S&(1<<(i-1))){
				for(int j=1;j<=n;j++){
					if(!(S&(1<<(j-1)))&&edge[i][j]){
						dp[S|(1<<(j-1))][j]=max(dp[S][i]+edge[i][j],dp[S|(1<<(j-1))][j]);
					}
				}
				int now=((tmp-1)^S)|(1<<(i-1));
				for(int M=now;M;M=(M-1)&now){
					if(M&(1<<(i-1))) dp[S|M][i]=max(dp[S][i]+sum[M],dp[S|M][i]);
				}
			}
		}
	}
	printf("%lld\n",ans-dp[tmp-1][n]);
}