#include <bits/stdc++.h>
using namespace std;
long long e[34][34];
long long dp[15][1 << 15];
long long solve(long long n, long long m, long long w) {
  long long ans = 0;
  for (long long i = 0; i < (n); i++) {
    if (w & (1 << i)) {
      for (long long j = 0; j < (n); j++) {
        if (m & (1 << j)) {
          ans += e[i][j];
        }
      }
    }
  }
  return ans;
}
signed main() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < (n); i++) {
    for (long long j = 0; j < (n); j++) {
      e[i][j] = 0;
    }
  }
  for (long long i = 0; i < (m); i++) {
    long long a, b, w;
    cin >> a >> b >> w;
    a--;
    b--;
    e[a][b] = w;
    e[b][a] = w;
  }
  for (long long i = 0; i < (n); i++) {
    for (long long j = 0; j < (1 << n); j++) {
      dp[i][j] = 1000000007LL;
    }
  }
  for (long long iw = 0; iw < (1 << n); iw++) {
    long long i = iw | 1;
    dp[0][i] = solve(n, 0, i);
  }
  for (long long i = 0; i < (1 << n); i++) {
    vector<long long> q;
    for (long long j = 0; j < (n); j++) {
      if (i & (1 << j)) {
        q.push_back(j);
      }
    }
    for (long long j = 0; j < (q.size()); j++) {
      for (long long k = 0; k < ((1 << (q.size() - 1))); k++) {
        long long w = 0;
        for (long long _ = 0; _ < (q.size() - 1); _++) {
          if (k & (1 << _)) {
            if (_ < j) {
              w |= 1 << q[_];
            } else {
              w |= 1 << q[_ + 1];
            }
          }
        }
        long long s = solve(n, w, i ^ w);
        for (long long _ = 0; _ < (n); _++) {
          dp[q[j]][i] = min(dp[q[j]][i], dp[_][w] + s - e[_][q[j]]);
        }
      }
    }
  }
  cout << dp[n - 1][(1 << n) - 1] << endl;
}
