#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<50;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int n,m;
vvi g;

int main(){
	cin>>n>>m;
	g=vvi(n,vi(n));
	int S=1<<n;
	vi dp(S);
	vvi DP(S,vi(n,-1));
	DP[1][0]=0;
	for(int i=0;i<m;i++){
		int u,v,c;
		cin>>u>>v>>c;
		u--;v--;
		g[u][v]=c;g[v][u]=c;
	}
	for(int i=1;i<S;i++) for(int j=0;j<n;j++) for(int k=j+1;k<n;k++) if(i&1<<j&&i&1<<k) dp[i]+=g[j][k];
	for(int i=1;i<S;i++) for(int j=0;j<n;j++) if(DP[i][j]!=-1){
		for(int k=0;k<n;k++) if(!(i&1<<k)&&g[j][k]) DP[i+(1<<k)][k]=max(DP[i+(1<<k)][k],DP[i][j]+g[j][k]);
		int T=S-i-1,T_=T;
		while(T){
			DP[i+T][j]=max(DP[i+T][j],DP[i][j]+dp[T+(1<<j)]);
			T=(T-1)&T_;
		}
	}
	cout<<dp[S-1]-DP[S-1][n-1]<<endl;
}