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;
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};
void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
template <typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template <typename T>
using Edges = vector<edge<T>>;
template <typename T>
using WG = vector<Edges<T>>;
using UG = vector<vector<int>>;
template <typename T>
using Matrix = vector<vector<T>>;
int main() {
  int v, e;
  cin >> v >> e;
  WG<int> es(v);
  vector<vector<int>> dp((1 << v), vector<int>(v, 1000000000));
  vector<int> cost(v, 1000000000);
  for (int i = (int)0; i < (int)e; i++) {
    int s, t, d;
    cin >> s >> t >> d;
    es[s].push_back(edge<int>(t, d));
    es[t].push_back(edge<int>(s, d));
    if (t == 0) {
      cost[s] = min(cost[t], d);
    }
  }
  dp[1][0] = 0;
  for (int i = (int)0; i < (int)(1 << v); i++) {
    for (int j = (int)0; j < (int)v; j++) {
      if (dp[i][j] == 1000000000) continue;
      for (auto et : es[j]) {
        if (i & (1 << et.to)) continue;
        dp[i | (1 << et.to)][et.to] =
            min(dp[i | (1 << et.to)][et.to], dp[i][j] + et.cost);
      }
    }
  }
  int ans = 1000000000;
  for (int i = (int)0; i < (int)v; i++) {
    ans = min(ans, dp[(1 << v) - 1][i] + cost[i]);
  }
  cout << ((ans == 1000000000) ? -1 : ans) << endl;
}
