#include <bits/stdc++.h>

const int MAXN = 15;
int mat[15][15], n, m, tot;
int f[1 << 15], g[1 << 15][15];
void gmax(int & x, int y) { x < y ? x = y : 0; }
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n >> m;
	memset(mat, 0xcf, sizeof mat);
	for (int i = 1, b, e, v; i <= m; ++i) {
		std::cin >> b >> e >> v, --b, --e;
		tot += mat[b][e] = mat[e][b] = v;
	}
	const int U = 1 << n;
	memset(g, 0xcf, sizeof g);
	const int NINF = **g;
	for (int i = 0; i != U; ++i)
		for (int j = 0; j != n; ++j) if (i >> j & 1)
			for (int k = j + 1; k != n; ++k) if (i >> k & 1)
				gmax(f[i], f[i] + mat[j][k]);
	for (int i = 0; i != U; ++i) if (i >> n - 1 & 1) g[i][n - 1] = f[i];
	for (int i = 0; i != U; ++i) {
		for (int j = 0; j != n; ++j) if (g[i][j] != NINF) {
			for (int k = 0; k != n; ++k) if ((~i >> k & 1) && mat[j][k] != NINF) {
				int iu = U - 1 - i - (1 << k);
				for (int l = iu; ; l = l - 1 & iu) {
					gmax(g[i | 1 << k | l][k], g[i][j] + mat[j][k] + f[l | 1 << k]);
					if (!l) break;
				}
			}
		}
	}
	std::cout << tot - g[U - 1][0] << std::endl;
	return 0;
}
