#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;

typedef long long LL;

int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}

inline void upd(int &x,int y) { x<y?x=y:0; }

int f[1<<15][15];
int sum[1<<15];
int e[15][15];
int main()
{
	int n=gi(),m=gi(),i,a,b,s,t,o,k;
	const int all=(1<<n)-1;
	
	while (m--) {
		a=gi()-1,b=gi()-1;
		e[a][b]=e[b][a]=gi();
		sum[1<<a|1<<b]+=e[a][b];
	}

	for (i=0;i<n;i++)
		for (s=0;s<(1<<n);s++)
			if (!(s>>i&1))
				sum[s|1<<i]+=sum[s];

	memset(f,-0x3f,sizeof(f));
	f[1][0]=0;
	for (s=1;s<(1<<n);s+=2)
		for (i=0;i<n;i++)
			if (f[s][i]>=0) {
				for (o=all^s,t=o;t;(--t)&=o)
					upd(f[s|t][i],f[s][i]+sum[t|1<<i]);
				
				for (k=0;k<n;k++)
					if (!(s>>k&1)&&e[i][k])
						upd(f[s|1<<k][k],f[s][i]+e[i][k]);
			}
	
	printf("%d\n",sum[all]-f[all][n-1]);
	return 0;
}
