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;
struct Edge {
  int src, dst;
  int weight;
  Edge(int src, int dst, int weight) : src(src), dst(dst), weight(weight) {}
};
bool operator<(const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight
         : e.src != f.src     ? e.src < f.src
                              : e.dst < f.dst;
}
int M = 99999999;
void salesman(const vector<vector<Edge> > g, int s, int w, vector<int> path) {
  if (path.size() == g.size()) {
    if (s == 0 && M > w) M = w;
    return;
  }
  for (__typeof((g[s]).begin()) e = (g[s]).begin(); e != (g[s]).end(); ++e)
    if (w + e->weight < M &&
        find(path.begin(), path.end(), e->dst) == path.end()) {
      path.push_back(e->dst);
      salesman(g, e->dst, w + e->weight, path);
      path.pop_back();
    }
}
int main() {
  int T, V, E, s, t, e;
  scanf("%d%d", &V, &E);
  vector<vector<Edge> > g(V);
  for (; E--;) scanf("%d%d%d", &s, &t, &e), g[s].push_back(Edge(s, t, e));
  vector<int> path;
  salesman(g, 0, 0, path);
  printf("%d\n", M == 99999999 ? -1 : M);
}
