#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int dp[1 << 15][15];
int cnt[1 << 15];
int m[15][15];
int main()
{
	int num, way;
	scanf("%d%d", &num, &way);
	int sum = 0;
	for (int i = 0; i < way; i++)
	{
		int za, zb, zc;
		scanf("%d%d%d", &za, &zb, &zc);
		za--, zb--;
		m[za][zb] = m[zb][za] = zc;
		sum += zc;
	}
	for (int p = 0; p < (1 << num); p++)
	{
		for (int i = 0; i < num; i++)
		{
			for (int j = i + 1; j < num; j++)
			{
				if ((p&(1 << i)) != 0 && (p&(1 << j)) != 0)cnt[p] += m[i][j];
			}
		}
	}
	for (int i = 0; i < (1 << num); i++)for (int j = 0; j < num; j++)dp[i][j] = -1000000000;
	for (int p = 0; p < (1 << num); p++)if (p & 1)dp[p][0] = cnt[p];
	for (int p = 0; p < (1 << num); p++)
	{
		for (int i = 0; i < num; i++)
		{
			if ((p&(1 << i)) == 0)continue;
			for (int j = 0; j < num; j++)
			{
				if (p&(1 << j))continue;
				if (m[i][j] == 0)continue;
				int mask = (1 << num) - 1 - p - (1 << j);
				int now = mask;
				for (;;)
				{
					dp[p | now | (1 << j)][j] = max(dp[p | now | (1 << j)][j], dp[p][i] + m[i][j] + cnt[now | (1 << j)]);
					if (now == 0)break;
					now--;
					now &= mask;
				}
			}
		}
	}
	printf("%d\n", sum - dp[(1 << num) - 1][num - 1]);
}