#include <bits/stdc++.h>
using namespace std;
int n,m,sum=0,f[40010][20],b[40010],dis[20][20];
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
	{
		int xx,yy,zz;
		scanf("%d%d%d",&xx,&yy,&zz);
		dis[xx][yy]=zz;
		dis[yy][xx]=zz;
		sum+=zz;
    }
    for (int i=1;i<(1<<n);i++)
	  for (int j=1;j<=n;j++)
	    if (i>>(j-1)&1)
	      for (int k=j+1;k<=n;k++)
	        if ((i>>(k-1))&1) b[i]+=dis[j][k];
	memset(f,-10,sizeof(f));
	f[1][1]=0;
	int N=(1<<n)-1;
	for (int i=1;i<=N;i++)
	  for (int j=1;j<=n;j++)
	    if ((i>>(j-1))&1)
	    {
	    	for (int k=1;k<=n;k++)
	    	  if (!((i>>(k-1))&1)&&dis[j][k]) f[i|(1<<(k-1))][k]=max(f[i|(1<<(k-1))][k],f[i][j]+dis[j][k]);
	    	for (int k=N^i;k;k=(k-1)&(N^i))
	    	  f[i|k][j]=max(f[i|k][j],f[i][j]+b[k|(1<<(j-1))]);
	    }
	cout<<sum-f[N][n];
}