#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int inf = 0x7fffffff;
int f[1<<15][15];
int w[1<<15][15];
int map[15][15];
int n, m;
void up(int &x, int y) { if(x < y) x = y; }
int main() {
	int i, j, k;
	scanf("%d%d", &n, &m);
	int sum = 0;
	for(i = 1; i <= m; i++){
		int x, y, d;
		scanf("%d%d%d", &x, &y, &d); x--; y--;
		map[x][y] = map[y][x] = d;
		sum += d;
	}
	for(i = 1; i < 1<<n; i++){
		int res = 0;
		for(j = 0; j < n; j++){
			for(k = j+1; k < n; k++) if(i&(1<<j) && i&(1<<k)) res += map[j][k];
		}
		for(j = 0; j < n; j++){
			if(i&(1<<j)) continue;
			w[i][j] = res;
			for(k = 0; k < n; k++){
				if(i&(1<<k)) w[i][j] += map[j][k];
			}
		}
	}
	for(j = 0; j < 1<<n; j++) for(i = 0; i < n; i++) f[j][i] = -inf;
	f[1][0] = 0;
	for(i = 1; i < 1<<n; i += 2){
		for(j = 0; j < n; j++){
			if(!(i&(1<<j))) continue;
			for(k = 0; k < n; k++){
				if(i&(1<<k) && j != k && map[j][k] != 0) up(f[i][j], f[i^(1<<j)][k]+map[j][k]);
			}
			for(k = (i-1)&i; k; k = (k-1)&i) if(k&(1<<j)) up(f[i][j], f[k][j]+w[i^k][j]);
		}
	}
	printf("%d\n", sum-f[(1<<n)-1][n-1]);
	return 0;
}