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