#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
int n, m, map[16][16];
ll in[1 << 16], f[1 << 16][16];
int main()
{
	scanf("%d%d", &n, &m);
	int x, y;
	for (int i = 1; i <= m; i++)
		scanf("%d%d", &x, &y), x--, y--, scanf("%d", &map[x][y]), map[y][x] = map[x][y];
	for (int i = 0; i < (1 << n); i++)
		for (int j = 0; j < n; j++)
			if (i & (1 << j))
				for (int k = j + 1; k < n; k++)
					if (i & (1 << k))
						in[i] += map[j][k];
	memset(f, -0x3f, sizeof(f));
	f[1][0] = 0;
	for (int i = 1; i < (1 << n); i++)
		for (int j = 0; j < n; j++)
			if (i & (1 << j))
			{
				int x = i ^ (1 << j);
				for (int k = 0; k < n; k++)
					if (i & (1 << k) && map[k][j])
						f[i][j] = max(f[i][j], f[x][k] + map[k][j]);
				for (int k = x; k; k = (k - 1) & x)
					f[i][j] = max(f[i][j], f[i ^ k][j] + in[1 << j ^ k]);
			}
	printf("%lld\n", in[(1 << n) - 1] - f[(1 << n) - 1][n - 1]);
}