#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9 + 7;
const int maxn = 16;
long long deg[maxn], dist[maxn][maxn], dp[(1 << 16)];
int n, m;
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  memset(deg, 0, sizeof deg);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      dist[i][j] = inf;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    ans += w;
    deg[u]++;
    deg[v]++;
    if (dist[u][v] > w) {
      dist[u][v] = w;
      dist[v][u] = w;
    }
  }
  for (int k = 1; k <= n; k++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (dist[i][j] > dist[i][k] + dist[k][j])
          dist[i][j] = dist[i][k] + dist[k][j];
      }
    }
  }
  for (int i = 2; i <= n; i++) {
    if (dist[1][i] == inf && deg[i] != 0) {
      cout << -1 << endl;
      return 0;
    }
  }
  int mask = 0;
  for (int i = 1; i <= n; i++) {
    if (deg[i] % 2 == 1) mask |= (1 << (i - 1));
  }
  dp[0] = 0;
  for (int k = 1; k <= mask; k++) {
    dp[k] = inf;
    for (int i = 1; i <= n; i++) {
      if (k & (1 << (i - 1))) {
        for (int j = i + 1; j <= n; j++)
          if (k & (1 << (j - 1))) {
            dp[k] = min(dp[k],
                        dp[k ^ (1 << (i - 1)) ^ (1 << (j - 1))] + dist[i][j]);
          }
      }
    }
  }
  cout << ans + dp[mask] << endl;
  return 0;
}
