#include<cstdio>
#include<algorithm>
using namespace std;
int D[1 << 15][15], S[1 << 15];
int w[15][15], n, m, sum;
int main() {
	int i, a, b, c, j, k, l;
	scanf("%d%d", &n, &m);
	for (i = 0; i < m; i++) {
		scanf("%d%d%d", &a, &b, &c);
		a--, b--;
		w[a][b] = w[b][a] = c;
		sum += c;
		for (j = 0; j < (1 << n); j++) {
			if (((~j)&((1 << a) | (1 << b))) == 0)S[j] += c;
		}
	}
	for (i = 0; i < (1 << n); i++) {
		for (j = 0; j < n; j++)D[i][j] = -1e9;
		if (i & 1) D[i][0] = S[i];
	}
	for (i = 0; i < (1 << n); i++) {
		for (j = 0; j < n; j++) {
			if (D[i][j] < 0)continue;
			int b = (1 << n) - i - 1;
			for (k = b;k; k = (k - 1)&b) {
				for (l = 0; l < n; l++) {
					if (w[j][l] && ((k >> l) & 1) ){
						D[i | k][l] = max(D[i | k][l], D[i][j] + S[k] + w[j][l]);
					}
				}
			}
		}
	}
	printf("%d\n", sum - D[(1 << n) - 1][n - 1]);
}