#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MAXN=15;
const int MAXP=(1<<MAXN);
int N,M;
int edge[MAXN][MAXN];
int cscore[MAXP];
int dp[MAXN][MAXP];
int main(){
    ios_base::sync_with_stdio(0);
    cin>>N>>M;
    for (int i=0;i<M;i++){
        int a,b,c;
        cin>>a>>b>>c;
        a--,b--;
        edge[a][b]=edge[b][a]=c;
    }
    for (int i=0;i<(1<<N);i++){
        cscore[i]=0;
        for (int j=0;j<N;j++){
            for (int k=j+1;k<N;k++){
                if (i&(1<<j) && i & (1<<k))
                    cscore[i]+=edge[j][k];
            }
        }
    }
    for (int i=0;i<MAXN;i++)
        for (int j=0;j<MXP;j++)
            dp[i][j]=-1e9;
    for (int i=1;i<(1<<N);i+=2)
        dp[0][i]=cscore[i];
    for (int i=0;i<(1<<N);i++){
        for (int j=0;j<N;j++){
            if (dp[j][i]<0) continue;
            int mask=(1<<N)-1-i;
            for (int sub=mask;sub>0;sub=(sub-1)&mask){
                for (int k=0;k<N;k++){
                    if (edge[j][k] && (sub&(1<<k)))
                        dp[k][i+sub]=max(dp[k][i+sub],dp[j][i]+cscore[sub]+edge[j][k]);
                }
            }
        }
    }
    ll ctot=0;
    for (int i=0;i<N;i++)
        for (int j=i+1;j<N;j++)
            ctot+=edge[i][j];
    cout<<ctot-dp[N-1][(1<<N)-1]<<"\n";
}