#include <bits/stdc++.h>
using namespace std;
const int MAXN = 17, MAXS = 32775;

int n, m, N, g[MAXN][MAXN], val[MAXS], dp[MAXS][MAXN];

inline void update(int &a, int b){if(a < b) a = b;}
int main(){
	int i, j, k, r, rest, u, v, w, sum = 0;
	scanf("%d%d", &n, &m);
	N = 1 << n;
	for(i = 1; i <= m; ++ i){
		scanf("%d%d%d", &u, &v, &w);
		-- u, -- v;
		g[u][v] = g[v][u] = w;
		sum += w;
	} memset(dp, -1, sizeof(dp));
	for(i = 1; i < N; ++ i){
		for(j = 0; j < n; ++ j)
			if(i & (1 << j)) break;
		val[i] = val[i ^ (1 << j)];
		for(k = j + 1; k < n; ++ k)
			if(i & (1 << k))
				val[i] += g[j][k];
		if(j == 0) dp[i][0] = val[i];
	}
	for(i = 1; i < N; ++ i)
		for(j = 0; j < n; ++ j){
			if((v = dp[i][j]) < 0) continue;
			for(k = 0; k < n; ++ k){
				if(i & (1 << k)) continue;
				if(g[j][k] == 0) continue;
				update(dp[i ^ (1 << k)][k], v + g[j][k]);
				for(rest = r = (N - 1) ^ i ^ (1 << k); r; r = (r - 1) & rest)
					update(dp[i ^ r ^ (1 << k)][k], v + val[r ^ (1 << k)] + g[j][k]);
			}
		}
	cout << sum - dp[N - 1][n - 1] << endl;
	return 0;
}