#include <bits/stdc++.h>
using namespace std;
int n, m;
int mp[16][16];
int cost[1 << 16][16], dp[1 << 16][16];
int inner[1 << 16];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int x, y, price;
    cin >> x >> y >> price;
    mp[x - 1][y - 1] = mp[y - 1][x - 1] = price;
  }
  for (int i = 0; i < 1 << n; i++) {
    for (int a = 0; a < n; a++) {
      if (i & (1 << a)) {
        for (int b = 0; b < a; b++) {
          if (i & (1 << b) && (mp[a][b])) {
            inner[i] += mp[a][b];
          }
        }
      } else {
        for (int b = 0; b < n; b++) {
          if ((i & (1 << b)) && mp[a][b]) {
            cost[i][a] += mp[a][b];
          }
        }
      }
    }
  }
  memset(dp, -1, sizeof(dp));
  dp[1][0] = 0;
  for (int i = 0; i < 1 << n; i++) {
    for (int a = 0; a < n; a++) {
      if ((i & (1 << a)) && dp[i][a] != -1) {
        for (int b = 0; b < n; b++) {
          if (!(i & (1 << b))) {
            if (mp[a][b]) {
              dp[i | (1 << b)][b] =
                  max(dp[i | (1 << b)][b], dp[i][a] + mp[a][b]);
            }
          }
        }
        int left = (1 << n) - 1 - i;
        for (int now = left; now != 0; now = (now - 1) & left) {
          int num = inner[now] + cost[now][a];
          dp[i | now][a] = max(dp[i | now][a], dp[i][a] + num);
        }
      }
    }
  }
  cout << dp[(1 << n) - 1][n - 1] << endl;
  return 0;
}
