#include <bits/stdc++.h>
using namespace std;

const int N = 16;

int dp[N][1 << N], sum[1 << N], G[N][N];

int main() {
	int n, m, res = 0; scanf("%d%d", &n, &m);
	for (int i = 1, a, b, c; i <= m; i++)
		scanf("%d%d%d", &a, &b, &c), G[a][b] = G[b][a] = c, res += c;
	for (int i = 1; i < 1 << n; i++)
		for (int j = 1; j <= n; j++) if (i & (1 << j - 1))
			for (int k = j + 1; k <= n; k++) if (i & (1 << k - 1))
				sum[i] += G[j][k];
	memset(dp, -0x3f, sizeof(dp));
	for (int s = 1; s < 1 << n; s++) if (s & 1) dp[1][s] = sum[s];
	for (int s = 1; s < 1 << n; s++)
		for (int i = 1; i < n; i++) if (dp[i][s] >= 0) {
			for (int j = 1; j <= n; j++) if (G[i][j] && !(s & (1 << j - 1))) {
				int t = (1 << n) - 1; t ^= s, t ^= (1 << j - 1);
				for (int t1 = t; ~t1; t1 = (t1 - 1) & t) {
					dp[j][s | (1 << j - 1) | t1] = max(dp[j][s | (1 << j - 1) | t1], 
						dp[i][s] + G[i][j] + sum[t1 | (1 << j - 1)]);
					if (!t1) break;
				}	
			}	
		}
	printf("%d\n", res - dp[n][(1 << n) - 1]);
}