#include<bits/stdc++.h> 
using namespace std;
int f[20][70010],sum[70010];
int mp[20][20];
int main()
{
	int n,m,all=0;scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
	{
		int u,v,w;scanf("%d%d%d",&u,&v,&w);
		mp[u][v]=mp[v][u]=w;all+=w;
	}
	memset(f,255,sizeof(f));
	for (int i=1;i<(1<<n);i++)
	for (int j=1;j<=n;j++) if((1<<(j-1))&i)
	for (int k=j+1;k<=n;k++) if((1<<(k-1))&i) sum[i]+=mp[j][k];
	for (int i=1;i<(1<<n);i++) if(i&1) f[1][i]=sum[i];
	for (int j=1;j<(1<<n);j++) 
	{
		for (int i=1;i<=n;i++) if(f[i][j]>=0)
		{
			int k=((1<<n)-1)^j;
			for(int p=k;p;p=(p-1)&k)
				for (int d=1;d<=n;d++)
					if(((1<<(d-1))&p)&&(mp[i][d])) f[d][j|p]=max(f[d][j|p],f[i][j]+mp[i][d]+sum[p]);
		}
	}
	int ans=0;
	for (int i=1;i<(1<<n);i++) ans=max(ans,f[n][i]);
	printf("%d\n",all-ans);
}