#include <bits/stdc++.h>
#define lowbit(x) ((x) & (- (x)))
#define rev(x) (((1 << n) - 1) ^ x)
#define R register
using namespace std;
const int N = 15, MAX = 1 << 15, MAX3 = 14348907, INF = 0x3f3f3f3f;
int n,m,su[N+2][MAX],dp[MAX][N + 2],trans[MAX],co[MAX3];
int main() {
  int x,y,z;
  scanf("%d%d",&n,&m);
  for (int i = 1 ; i <= m ; ++ i) {
    scanf("%d%d%d",&x,&y,&z);
    su[x][1 << y >> 1] += z;
    su[y][1 << x >> 1] += z;
  }
  for (int i = 1 ; i <= n ; ++ i)
    for (R int j = 1 ; j < (1 << n) ; ++ j)
      su[i][j] = su[i][j - lowbit(j)] + su[i][lowbit(j)];
  for (R int i = 1 ; i < (1 << n) ; ++ i) {
    for (int j = 1, t = 1 ; j <= n ; ++ j, t *= 3) 
      if ((i >> j-1)&1) trans[i] += t;
  }
  for (R int i = 1 ; i < (1 << n) ; ++ i)
    for (R int j = rev(i) ; j ; j = (j-1)&rev(i)) {
      int t = trans[i] + 2 * trans[j];
      for (int k = 1 ; k <= n ; ++ k)
        if ((i >> k-1)&1) co[t] += su[k][j];
    }
  memset(dp,0x3f,sizeof dp);
  dp[1][1] = 0;
  for (R int i = 1 ; i < (1 << n >> 1) ; ++ i) {
    for (int j = 1 ; j <= n ; ++ j) if ((i >> j-1)&1) {
      if (dp[i][j] == INF) continue;
      for (R int k = rev(i) ; k ; k = (k-1)&rev(i))
        for (int a = 1 ; a <= n ; ++ a) if (((k >> a-1)&1)&&(su[a][1<<j>>1]))
          dp[i|k][a] = min(dp[i|k][a],dp[i][j]+co[trans[k]+2*trans[i]]-su[a][1<<j>>1]);
    }
  }
  printf("%d\n",dp[(1 << n) - 1][n]);
  return 0;
}