#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 17;
const int L = 32775;
const int INF = 2e+9;

int f[L][N],val[L];
int n,m;
struct edge{
	int x,y,l;
}e[N*N];
int d[N][N];

int main(){
	n=get();m=get();
	int sum=0;
	fo(i,1,m){
		e[i].x=get();e[i].y=get();e[i].l=get();
		sum+=e[i].l;
		d[e[i].x][e[i].y]=d[e[i].y][e[i].x]=e[i].l;
	}
	fo(t,1,(1<<n)-1){
		fo(i,1,m)
		if (((1<<(e[i].x-1))&t)>0&&((1<<(e[i].y-1))&t)>0)val[t]+=e[i].l;
	}
	fo(t,0,(1<<n)-1)fo(x,1,n)f[t][x]=-1;
	fo(t,1,(1<<(n-1))-1)
	if (t&1)f[t][1]=val[t];
	fo(t,1,(1<<n)-1)
		fo(x,1,n)
		if (f[t][x]>-1){
			int u=((1<<n)-1)^t;
			int p=u;
			for(;u;u=(u-1)&p){
				fo(y,1,n)
				if (((1<<(y-1))&u)>0&&d[x][y])f[t^u][y]=max(f[t^u][y],f[t][x]+d[x][y]+val[u]);
			}
		}
	printf("%d\n",sum-f[(1<<n)-1][n]);
	return 0;
}
#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;
}
