#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long t = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') t = t * 10 + c - 48, c = getchar();
  return t * f;
}
const int N = (1 << 20);
int n, m, e[30][30], in[N], to[N][30], dp[N][30];
int x, y, z;
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= m; ++i) {
    x = read();
    y = read();
    z = read();
    e[x][y] = e[y][x] = z;
  }
  int mx = (1 << (n + 1)) - 1;
  for (int i = 1; i <= mx; ++i)
    for (int j = 1; j <= n; ++j)
      if ((i & (1 << j)))
        for (int k = j + 1; k <= n; ++k)
          if ((i & (1 << k))) in[i] += e[j][k];
  for (int i = 1; i <= mx; ++i)
    for (int j = 1; j <= n; ++j) {
      for (int k = 1; k <= n; ++k)
        if (i & (1 << k)) to[i][j] += e[j][k];
    }
  for (int i = 0; i <= mx; ++i)
    for (int j = 0; j <= n; ++j) dp[i][j] = -1;
  dp[2][1] = 0;
  for (int i = 2; i <= mx; ++i)
    for (int j = 1; j <= n; ++j)
      if (dp[i][j] >= 0)
        if (i & (1 << j)) {
          for (int k = 1; k <= n; ++k)
            if (i & (1 << k))
              continue;
            else if (e[j][k])
              dp[i | (1 << k)][k] =
                  max(dp[i | (1 << k)][k], dp[i][j] + e[j][k]);
          int Cu = mx - i;
          for (int tmp = mx - i; tmp; tmp = (tmp - 1) & Cu) {
            dp[i | tmp][j] =
                max(dp[i | tmp][j], dp[i][j] + to[tmp][j] + in[tmp]);
          }
        }
  printf("%d\n", in[mx] - dp[mx][n]);
}
