#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=(b); i++)
#define subset(i,S) for (int i=(S); i; i=(i-1)&(S))
using namespace std;

const int maxn = 16;
int f[1<<maxn][maxn], cost[1<<maxn], w[maxn][maxn];
int n, m, a, b, c, S, total;

void init() {
	rep (i, 1, (1<<n)-1) 
		rep (x, 0, n-1) if (i>>x&1)
			rep (y, x+1, n-1) if (i>>y&1)
				cost[i] += w[x][y];
}

int main() {
	scanf("%d%d", &n, &m);
	rep (i, 1, m) {
		scanf("%d%d%d", &a, &b, &c); a--; b--;
		w[a][b] = w[b][a] = c; total += c;
	}
	init();
	memset(f, -1, sizeof f);
	f[1][0] = 0;
	rep (i, 1, (1<<n)-1)
		rep (j, 0, n-1) if ((i>>j&1) && ~f[i][j]) {
			S = (((1<<n)-1)^i)|(1<<j);
			subset (s, S) f[i|s][j] = max(f[i|s][j], f[i][j] + cost[s]);
			rep (k, 0, n-1) if (!(i>>k&1) && w[j][k]) f[i|(1<<k)][k] = max(f[i|(1<<k)][k], f[i][j] + w[j][k]);
		}
	printf("%d\n", total - f[(1<<n)-1][n-1]);
	return 0;
}