//Δ
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 15;
const int M = 1<<N;
const int inf = 1e9;
inline void cmax(int& x,int y){
	if(x<y)
		x=y;
}
int n,m,a[N][N],b[M],f[M][N],t[M];
int main()
{
	int i,j,k,x,y,z,s=0;
	cin>>n>>m;
	while(m--){
		cin>>x>>y>>z;
		x--,y--;
		a[x][y]=z,a[y][x]=z;
		for(i=0;i<(1<<n);i=i+1)
			if(i&(1<<x))
				if(i&(1<<y))
					b[i]+=z;
		s+=z;
	}
	m=(1<<n)-1;
	for(i=0;i<=m;i=i+1){
		for(x=0;x<n;x=x+1)
			f[i][x]=-inf;
		if(i&1)
			f[i][0]=b[i];
	}
	for(x=0;x<n;x=x+1)
		t[1<<x]=x;
	for(i=0;i<=m;i=i+1){
		for(x=0;x<n;x=x+1){
			if(f[i][x]>=0){
				z=m^i;
				for(j=z;j;j=(j-1)&z){
					for(k=j;k;k=k^(k&-k)){
						y=t[k&-k];
						if(a[x][y])
							cmax(f[i|j][y],f[i][x]+a[x][y]+b[j]);
					}
				}
			}
		}
	}
	cout<<s-f[m][n-1];
	return 0;
}