#include <bits/stdc++.h>
using namespace std;
using lint = long long;
int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> G(N, vector<int>(N));
  for (int i = 0; i < M; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    G[a][b] = G[b][a] = c;
  }
  vector<vector<int>> dp(1 << N, vector<int>(N, -1));
  dp[1][0] = 0;
  for (int S = 1; S < (1 << N); S++)
    for (int v = 0; v < N; v++)
      if (dp[S][v] != -1) {
        for (int u = 0; u < N; u++) {
          if (~S >> u & 1 and G[v][u] > 0) {
            dp[S | (1 << u)][u] = max(dp[S | (1 << u)][u], dp[S][v] + G[v][u]);
          }
        }
      }
  map<pair<int, int>, int> dp2;
  function<int(int, int)> rec = [&](int S, int T) {
    if (dp2.count({S, T})) return dp2[{S, T}];
    int res = 0, mx = 0;
    for (int i = 0; i < N - 1; i++)
      for (int j = i + 1; j < N; j++) {
        if (S >> i & 1 and S >> j & 1) continue;
        if (T >> i & 1 and T >> j & 1)
          res += G[i][j];
        else
          mx = max(mx, G[i][j]);
      }
    res += mx;
    for (int R = (T - 1) & T; R > 0; R = (R - 1) & T) {
      res = max(res, rec(S, R) + rec(S, T ^ R));
    }
    return dp2[{S, T}] = res;
  };
  const int U = (1 << N) - 1;
  int ans = 0;
  for (int S = 1; S < (1 << N); S++)
    if (dp[S][N - 1] != -1) {
      int T = U ^ S;
      ans = max(ans, rec(S, T));
    }
  cout << ans << endl;
  return 0;
}
