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

const int INF = 1e9;

const int MAXN = 15;
int N;
int W[MAXN][MAXN];

int V[1<<MAXN];
int dp[1<<MAXN][MAXN];

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	int M;
	cin >> N >> M;
	int tot = 0;
	for (int i = 0; i < M; i++) {
		int a, b, c; cin >> a >> b >> c; a--, b--;
		W[a][b] = W[b][a] = c;
		tot += c;
	}

	for (int m = 0; m < (1<<N); m++) {
		for (int i = 0; i < N; i++) {
			for (int j = i+1; j < N; j++) {
				if ((m & (1 << i)) && (m & (1 << j))) {
					V[m] += W[i][j];
				}
			}
		}
	}

	for (int m = 0; m < (1<<N); m++) {
		for (int i = 0; i < N; i++) {
			dp[m][i] = -INF;
		}
	}
	dp[1][0] = 0;
	for (int m = 1; m < (1<<N); m++) {
		for (int i = 0; i < N; i++) {
			if (dp[m][i] == -INF) continue;

			for (int j = 0; j < N; j++) {
				if (m & (1 << j)) continue;
				if (W[i][j] == 0) continue;
				dp[m | (1 << j)][j] = max(dp[m | (1 << j)][j], dp[m][i] + W[i][j]);
			}

			int c = (1 << N) - 1 - m;
			for (int v = c; v; v = (v-1) & c) {
				dp[m|v][i] = max(dp[m|v][i], dp[m][i] + V[v | (1 << i)]);
			}
		}
	}
	cout << tot - dp[(1<<N)-1][N-1] << '\n';

	return 0;
}
