#include <cstdio>

#define bin(x) (1<<(x))
#define b(x) (1<<(x)>>1)

inline void cmax(int&x, const int y) {x < y && (x = y);}

const int N = 17, M = 40100;
int f[N][M], g[M];
int mp[N][N];
int n, m;

int main() {
	scanf("%d%d",&n,&m); int Ans = 0;
	for(int i=1,x,y,z;i<=m;++i) {
		scanf("%d%d%d",&x,&y,&z), Ans += z;
		mp[x][y] = mp[y][x] = z;
	}
	for(int s=0;s<bin(n);++s) {
		int&v = g[s];
		for(int i=1;i<=n;++i) if(s & b(i)) 
		for(int j=i+1;j<=n;++j) if(s & b(j)) v += mp[i][j];
	}
	for(int i=1;i<=n;++i)
	for(int j=0;j<bin(n);++j)
		f[i][j] = -1;
	
	f[1][1] = 0;
	for(int S=1;S<bin(n);++S)
	for(int i=1;i<=n;++i) if((S & b(i)) and ~f[i][S]) {
		for(int j=1;j<=n;++j) if((~S & b(j)) and mp[i][j]) cmax(f[j][S|b(j)], f[i][S] + mp[i][j]);
		for(int iS=(bin(n)-1)^S, s = iS; s; s = (s-1) & iS)
			cmax(f[i][S|s], f[i][S] + g[s|b(i)]);
	}
	printf("%d\n", Ans - f[n][bin(n)-1]);
	return 0;
}