#include<bits/stdc++.h>
using namespace std;

int N,M;
int G[15][15];

int dp[15][(1<<15)];
int INF=2e9;

int calc(int bit,int nbit){
  int sum=0;
  for(int i=0;i<N;i++)
    if(nbit>>i&1)
      for(int j=0;j<N;j++)
        if(~bit>>j&1)
          if(~nbit>>j&1)
            sum+=G[i][j];
  return sum;
}



int rec(int pos,int bit){
  static unordered_map< int , int > mem[15];
  if( mem[pos].count(bit) )return mem[pos][bit];
  
  if(pos==N-1)return 0;
  int res=INF;

  int sup=(1<<(N-1))-1-bit;
  
  int nbit=sup;
  while(1){

    if(nbit>>pos&1){
      int cost=calc(bit,nbit);
      for(int to=0;to<N;to++){
        if(bit>>to&1)continue;
        if(nbit>>to&1)continue;
        if(G[pos][to]==0)continue;
        res=min(res, rec(to,bit|nbit) + cost - G[pos][to]);
      }
    }
    nbit--;
    nbit&=sup;
    if(nbit==0)break;
  }
  return mem[pos][bit]=res;
}

int main(){
  cin>>N>>M;
  for(int i=0;i<M;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--,b--;
    G[a][b]=G[b][a]=c;
  }
  cout<< rec(0,0) <<endl;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int inf=0x3f3f3f3f;
int val[15][15],sum[1<<15],dp[15][1<<15],f[15];
int main(){
	int n=read(),m=read();
	while(m--){
		int x=read()-1,y=read()-1,z=read();
		val[x][y]=z,val[y][x]=z;
		sum[(1<<x)|(1<<y)]=z;
	}
	REP(i,0,n-1) REP(j,0,(1<<n)-1) if((1<<i)&j) sum[j]+=sum[j^(1<<i)];
	REP(i,0,n-1) REP(j,0,(1<<n)-1) dp[i][j]=-inf;
	REP(j,1,(1<<n)-1) if(j&1) dp[0][j]=sum[j];
	REP(i,1,(1<<n)-1){
		REP(j,0,n-1) f[j]=-inf;
		REP(j,0,n-1) if(i&(1<<j)) REP(k,0,n-1) if(val[j][k] && (i&(1<<k))==0) chkmax(f[k],dp[j][i]+val[j][k]);
		REP(j,0,n-1) if((i&(1<<j))==0)
			for(int cur=i|(1<<j),k=cur;k<=iend;k=(k+1)|cur)
				chkmax(dp[j][k],f[j]+sum[k^i]);
	}
	printf("%d\n",sum[(1<<n)-1]-dp[n-1][(1<<n)-1]);
	return 0;
}
