#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n,m,g[101][101],w[1<<15],dp[1<<15][101];
int main()
{
	scanf("%d%d",&n,&m);int sum=0;for(int i=1;i<=m;++i){int a,b,c;scanf("%d%d%d",&a,&b,&c);g[a][b]=g[b][a]=c;sum+=c;}
	for(int i=0;i<(1<<n);++i)for(int j=1;j<=n;++j)if(i&(1<<j-1))for(int k=j+1;k<=n;++k)if(i&(1<<k-1))w[i]+=g[j][k];
	memset(dp,-1,sizeof(dp));for(int i=1;i<(1<<n);i+=2)dp[i][1]=w[i];
	for(int i=0;i<(1<<n);++i)
	{
		for(int j=1;j<=n;++j)if((i&(1<<j-1))&&~dp[i][j])
		{
			int tmp=(~i)&((1<<n)-1);
			for(int l=1;l<=n;++l)if((tmp&(1<<l-1))&&g[l][j])dp[i|(1<<l-1)][l]=max(dp[i|(1<<l-1)][l],dp[i][j]+g[l][j]);
			for(int k=tmp;k;k=(k-1)&tmp)dp[i|k][j]=max(dp[i|k][j],dp[i][j]+w[k|(1<<j-1)]);
		}
	}
	printf("%d\n",sum-dp[(1<<n)-1][n]);return 0;
}