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

#define debug(...) fprintf(stderr, __VA_ARGS__)

const long long inf = 1e18;

int n, m, adj[15 + 5][15 + 5];
long long dp[(1 << 15) + 5][15 + 5];

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; ++i) {
		int x, y, w;
		scanf("%d%d%d", &x, &y, &w), --x, --y;
		adj[x][y] = adj[y][x] = w;
	}
//	for (int i = 0; i < n; ++i) {
//		for (int j = 0; j < n; ++j)
//			debug("%d ", adj[i][j]);
//		debug("\n");
//	}
	for (int i = 0; i < (1 << n); ++i)
		for (int j = 0; j < n; ++j)
			dp[i][j] = inf;
	for (int i = 1; i < (1 << n); i += 2)
		dp[i][0] = 0;
	for (int i = 1; i < (1 << n); i += 2)
		for (int j = i; j; (--j) &= i) {
			if (j & 1) continue;
			int t = i ^ j;
			long long tot = 0;
			for (int k = 0; k < n; ++k) {
				if (~t & 1 << k) continue;
				for (int p = 0; p < n; ++p)
					if (j & 1 << p) tot += adj[k][p];
			}
			for (int l = 0; l < n; ++l) {
				if (~t & 1 << l) continue;
				for (int k = 0; k < n; ++k)
					if (j & 1 << k && adj[l][k])
						dp[i][k] = min(dp[i][k], dp[t][l] + tot - adj[l][k]);
			}
		}
	printf("%lld\n", dp[(1 << n) - 1][n - 1]);
}