#include <bits/stdc++.h>
int n,m,x,y,z;
int a[20][20],sum,dp[1<<15][15],f[1<<15];
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++){
		scanf("%d%d%d",&x,&y,&z);
		x--,y--;
		a[x][y]=a[y][x]=z;
		sum+=z;
	}
	for (int i=1;i<1<<n;i++)
		for (int j=0;j<n;j++)
			for (int k=j+1;k<n;k++)
				if ((i&(1<<j))&&(i&(1<<k)))
					f[i]+=a[j][k];
	memset(dp,-1,sizeof(dp));
	dp[1][0]=0;
	int all=(1<<n)-1;
	for (int i=1;i<1<<n;i+=2){
		for (int j=0;j<n;j++)
			if (i&(1<<j)){
				int t=dp[i][j];
				if (t==-1) continue;
				for (int k=0;k<n;k++){
					if (i&(1<<k)) continue;
					if (a[j][k]) dp[i|(1<<k)][k]=std::max(dp[i|(1<<k)][k],t+a[j][k]);
				}
				int rest=all^i;
				for (int k=rest;k;k=(k-1)&rest){
					dp[i|k][j]=std::max(dp[i|k][j],t+f[k|(1<<j)]);
				}
			}
	} 
	printf("%d\n",sum-dp[all][n-1]);
}