#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;

LL e[25][25] = {0};
LL W[1 << 16] = {0};
LL dp[1 << 16][25] = {0};
LL n,m,tot = 0;

int main(){
	cin >> n >> m;
	for(LL i = 1;i <= m;i ++){
		LL u,v,w;
		cin >> u >> v >> w;
		e[u][v] = w;
		e[v][u] = w;
		tot += w;
	}
	for(LL S = 0;S < (1LL << n);S ++){
		for(LL i = 1;i <= n;i ++){
			for(LL j = i + 1;j <= n;j ++){
				if(((S >> (i - 1)) & 1) && ((S >> (j - 1)) & 1)) W[S] += e[i][j];
			}
		}
	}
	memset(dp,-0x3f,sizeof(dp));
	dp[1][1] = 0;
	for(LL S = 0;S < (1LL << n);S ++){
		for(LL u = 1;u <= n;u ++){
			if(!((S >> (u - 1)) & 1)) continue;
			for(LL v = 1;v <= n;v ++){
				if((S >> (v - 1)) & 1) continue;
				if(!e[u][v]) continue;
				dp[S | (1 << (v - 1))][v] = max(dp[S | (1 << (v - 1))][v],dp[S][u] + e[u][v]);
			}
			LL U = ((1LL << n) - 1) ^ S;
			for(LL T = U;T;T = (U & (T - 1))){
				dp[S | T][u] = max(dp[S | T][u],dp[S][u] + W[T | (1 << (u - 1))]);
			}
		}
	}
	cout << tot - dp[(1LL << n) - 1][n] << endl;
	return 0;
}