#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, z, p[25], mp[25][25], g[1 << (25 - 7)], dp[1 << (25 - 7)][25];
int main() {
  scanf("%d%d", &n, &m);
  int sum = 0;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &x, &y, &z);
    mp[x][y] = mp[y][x] = z;
    sum += z;
  }
  for (int i = 0; i < (1 << n); i++) {
    int cnt = 0;
    g[i] = 0;
    for (int j = 0; j < n; j++)
      if (i >> j & 1) p[++cnt] = j + 1;
    for (int j = 1; j < cnt; j++)
      for (int k = j + 1; k <= cnt; k++) g[i] += mp[p[j]][p[k]];
  }
  memset(dp, 0x88, sizeof dp);
  dp[0][0] = 0;
  mp[0][1] = 1;
  for (int i = 1; i < (1 << n); i++)
    for (int j = 1; j <= n; j++) {
      if (!(i >> (j - 1))) continue;
      int S = i ^ (1 << (j - 1));
      for (int k = S;; k = (k - 1) & S) {
        for (int kk = 1; kk <= n; kk++)
          if (k >> (kk - 1) & 1 && mp[kk][j])
            dp[i][j] = max(dp[i][j], dp[k][kk] + mp[kk][j] + g[k ^ i]);
        if (k == 0) {
          if (j == 1) {
            dp[i][j] = max(dp[i][j], dp[k][0] + mp[0][j] + g[k ^ i]);
          }
          break;
        }
      }
    }
  printf("%d\n", sum - dp[(1 << n) - 1][n] + 1);
  return 0;
}
