For a given weighted directed graph G(V, E), find the distance of the shortest route that meets the following criteria:

* It is a closed cycle where it ends at the same point it starts.
* It visits each vertex exactly once.

Constraints

* 2 ≤ |V| ≤ 15
* 0 ≤ di ≤ 1,000
* There are no multiedge

Input


|V| |E|
s0 t0 d0
s1 t1 d1
:
s|E|-1 t|E|-1 d|E|-1


|V| is the number of vertices and |E| is the number of edges in the graph. The graph vertices are named with the numbers 0, 1,..., |V|-1 respectively.

si and ti represent source and target vertices of i-th edge (directed) and di represents the distance between si and ti (the i-th edge).

Output

Print the shortest distance in a line. If there is no solution, print -1.

Examples

Input

4 6
0 1 2
1 2 3
1 3 9
2 0 1
2 3 6
3 2 4


Output

16


Input

3 3
0 1 1
1 2 1
0 2 1


Output

-1
#include <bits/stdc++.h>
using namespace std;
long long int dx[] = {1, -1, 0, 0};
long long int dy[] = {0, 0, 1, -1};
long long int const MOD = 1000000007;
long long mod_pow(long long x, long long n) {
  return (!n) ? 1 : (mod_pow((x * x) % MOD, n / 2) * ((n & 1) ? x : 1)) % MOD;
}
long long int madd(long long int a, long long int b) { return (a + b) % MOD; }
long long int msub(long long int a, long long int b) {
  return (a - b + MOD) % MOD;
}
long long int mmul(long long int a, long long int b) { return (a * b) % MOD; }
long long int minv(long long int a) { return mod_pow(a, MOD - 2); }
long long int mdiv(long long int a, long long int b) {
  return mmul(a, minv(b));
}
namespace std {
bool operator<(const complex<double>& a, const complex<double>& b) {
  return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag();
}
}  // namespace std
long long int V, E;
long long int dp[1 << 15][20];
signed main() {
  cin >> V >> E;
  vector<vector<pair<long long int, long long int> > > G(V);
  for (long long int(i) = (0); (i) < (E); (i)++) {
    long long int s, t, d;
    cin >> s >> t >> d;
    G[s].push_back(pair<long long int, long long int>(t, d));
  }
  memset(dp, 0, sizeof(dp));
  for (long long int(i) = (0); (i) < ((1 << V)); (i)++)
    for (long long int(j) = (0); (j) < (20); (j)++) dp[i][j] = 2000000000;
  dp[(1 << V) - 1][0] = 0;
  for (long long int(bit) = ((1 << V) - 2); (bit) >= (0); (bit)--) {
    for (long long int(i) = (0); (i) < (V); (i)++) {
      for (long long int(j) = (0); (j) < (G[i].size()); (j)++) {
        long long int to = G[i][j].first, cost = G[i][j].second;
        if (bit >> to & 1) continue;
        long long int nbit = bit | (1 << to);
        dp[bit][i] = min(dp[bit][i], dp[nbit][to] + cost);
      }
    }
  }
  long long int ans = 2000000000;
  for (long long int(i) = (0); (i) < (V); (i)++) ans = min(ans, dp[0][i]);
  if (ans != 2000000000)
    cout << ans << endl;
  else
    cout << -1 << endl;
  return 0;
}
