#include <bits/stdc++.h>
using namespace std;
const int MaxN=15;
int n,m,ans,e[MaxN][MaxN],c[1<<MaxN],dp[1<<MaxN][MaxN];
int main() {
    scanf("%d%d",&n,&m);
    for (int i=1;i<=m;++i) {
        int u,v,w;
        scanf("%d%d%d",&u,&v,&w);
        u--,v--;
        e[u][v]=e[v][u]=w;
        ans+=w;
    }
    for (int i=0;i<(1<<n);++i) for (int j=0;j<n;++j) for (int k=j+1;k<n;++k) if (i&(1<<j) && i&(1<<k)) c[i]+=e[j][k];
    memset(dp,0xff,sizeof dp);dp[1][0]=0;
    for (int S=0;S<(1<<n);++S) for (int i=0;i<n;++i) if (dp[S][i]!=-1) {
        int SS=((1<<n)-1)^S;
        for (int j=0;j<n;++j) if (SS&(1<<j) && e[i][j]) 
            dp[S|(1<<j)][j]=max(dp[S|(1<<j)][j],dp[S][i]+e[i][j]);
        for (int j=SS;j;j=(j-1)&SS) 
            dp[S|j][i]=max(dp[S|j][i],dp[S][i]+c[j|(1<<i)]);
    }
    ans-=dp[(1<<n)-1][n-1];
    printf("%d\n",ans);
    return 0;
}