#include <bits/stdc++.h>
#define in(x, S) (S & (1 << (x - 1)))
using namespace std;

const int MAXN = 15 + 10, MAXSTATUS = (1 << 15) + 10;

int n, m, e[MAXN][MAXN], g[MAXSTATUS], f[MAXN][MAXSTATUS], num;

int main() {
    scanf("%d %d", &n, &m);
    for (int i = 1, u, v, w; i <= m; ++i) {
        scanf("%d %d %d", &u, &v, &w), num += w;
        e[u][v] = e[v][u] = w;
    } 
    int MAXS = 1 << n;
    for (int S = 0; S < MAXS; ++S) {
        for (int i = 1; i <= n; ++i) {
            for (int j = i + 1; j <= n; ++j) {
                if (in(i, S) && in(j, S) && e[i][j]) g[S] += e[i][j];
            }
        }
    }
    memset(f, -1, sizeof f);
    f[1][1] = 0;
    for (int S = 1; S < MAXS; ++S) {
        for (int i = 1; i <= n; ++i) if (in(i, S) && f[i][S] != -1) {
            for (int j = 1; j <= n; ++j) {
                if (!in(j, S) && e[i][j]) {
                    f[j][S | (1 << (j - 1))] = max(f[j][S | (1 << (j - 1))], f[i][S] + e[i][j]);
                }
            }
            for (int tmp = (MAXS - 1) ^ S, T = tmp; T; T = (T - 1) & tmp) {
                f[i][S | T] = max(f[i][S | T], f[i][S] + g[T | (1 << (i - 1))]);
            }
        }
    }
    printf("%d\n", num - f[n][MAXS - 1]);
    return 0;
}