#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

typedef vector<int> vi;

const int INF = (int)1e9;
int N, M;
vector<vi> G;
vector<vi> dp;
vi cost;
int total = 0;

int main(void) {
	cin >> N >> M;
	vi v0(N, 0);
	G.resize(N, v0);
	for (int i = 0; i < M; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		G[a - 1][b - 1] = G[b - 1][a - 1] = c;
		total += c;
	}

	cost.resize(1 << N, 0);
	for (int i = 0; i < (1 << N); ++i) {
		for (int j = 0; j < N; ++j) {
			if ((i >> j) & 1) {
				for (int k = j + 1; k < N; ++k) {
					if ((i >> k) & 1)
						cost[i] += G[j][k];
				}
			}
		}
	}

	vi v1(N, -INF);
	dp.resize(1 << N, v1);
	for (int i = 0; i < (1 << N); ++i) {
		if (i & 1)
			dp[i][0] = cost[i];
	}

	for (int S = 0; S < (1 << N); ++S) {
		for (int i = 0; i < N; ++i) {
			if (dp[S][i] == -INF)
				continue;
			int sup = (~S) & ((1 << N) - 1);
			int sub = sup;
			for (int sub = sup; sub; sub = ((sub - 1) & sup)) {
				for (int j = 0; j < N; ++j) {
					if (G[i][j] != 0 && ((sub >> j) & 1))
						dp[S | sub][j] = max(dp[S | sub][j], dp[S][i] + G[i][j] + cost[sub]);
				}
			}
		}
	}

	int ans = total - dp[(1 << N) - 1][N - 1];
	cout << ans << '\n';
	return 0;
}
