#include <bits/stdc++.h>
using namespace std;
const int maxn = 15;
int mmap[maxn][maxn];
int in[1 << maxn];
int dp[1 << maxn][maxn];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0, f, t, d; i < m; ++i) {
    scanf("%d%d%d", &f, &t, &d);
    mmap[t - 1][f - 1] = mmap[f - 1][t - 1] = d;
  }
  for (int i = 0; i < (1 << n); ++i)
    for (int j = 0; j < n; ++j)
      if (i & (1 << j))
        for (int k = j + 1; k < n; ++k)
          if (i & (1 << k)) in[i] += mmap[j][k];
  for (int i = 0; i < (1 << n); ++i) {
    for (int j = 0; j < n; ++j) {
      if (i & (1 << j)) {
        if (!j)
          dp[i][j] = in[i];
        else {
          for (int k = 0; k < n; ++k)
            if (i & (1 << k))
              dp[i][j] = max(dp[i][j], dp[i ^ (1 << j)][k] + mmap[j][k]);
          for (int k = i; k; k = (k - 1) & i)
            if ((i ^ k) & (1 << j))
              dp[i][j] = max(dp[i][j], dp[i ^ k][j] + in[k]);
        }
      }
    }
  }
  printf("%d\n", in[(1 << n) - 1] - dp[(1 << n) - 1][n - 1]);
  return 0;
}
