#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

template <class T>
inline void relax(T &a, const T &b)
{
	if (b > a)
		a = b;
}

const int MaxN = 15;
const int INF = 0x3f3f3f3f;

int n, m;
int mat[MaxN][MaxN];

int sum[1 << MaxN];

int result = -INF;

int f[1 << MaxN][MaxN];

int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; ++i)
	{
		int u, v, w;
		cin >> u >> v >> w, --u, --v;

		mat[u][v] = w;
		mat[v][u] = w;
	}

	int all = 1 << n;
	for (int s = 1; s < all; ++s)
	{
		int u = __builtin_ctz(s);

		sum[s] = sum[s ^ (s & -s)];
		for (int v = u + 1; v < n; ++v)
			if (s >> v & 1)
				sum[s] += mat[u][v];
	}

	for (int s = 0; s < all; ++s)
		for (int u = 0; u < n; ++u)
			f[s][u] = -INF;
	f[1][0] = 0;

	for (int s = 1; s < all; ++s)
	{
		for (int u = 0; u < n; ++u)
		{
			if (f[s][u] < 0)
				continue;

			int ex = (all - 1) ^ s;
			for (int t = ex; t; --t &= ex)
				relax(f[s | t][u], f[s][u] + sum[t | 1 << u]);

			for (int v = 0; v < n; ++v)
				if (mat[u][v] && ~s >> v & 1)
					relax(f[s | 1 << v][v], f[s][u] + mat[u][v]);
		}

		relax(result, f[s][n - 1]);
	}

	cout << sum[all - 1] - result << endl;

	return 0;
}