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
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

// aoj DPL_2_A Traveling Salesman Problem
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		int v = sc.nextInt();
		int e = sc.nextInt();

		@SuppressWarnings("unchecked")
		List<Edge>[] edges = new List[v];
		for (int i = 0; i < v; i++) {
			edges[i] = new ArrayList<Edge>();
		}

		for (int i = 0; i < e; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int d = sc.nextInt();
			edges[s].add(new Edge(s, t, d));
		}

		final int INF = Integer.MAX_VALUE;
		int min = INF;
		for (int s = 0; s < v; s++) {
			int[][] dp = new int[v][1 << v];
			for (int[] tmp : dp) {
				Arrays.fill(tmp, INF);
			}
			dp[s][1 << s] = 0;
			
			for (int S = 1; S < 1 << v; S++) {
				for (int j = 0; j < v; j++) {
					if ((S & (1 << j)) == 0 || dp[j][S] == INF) {
						continue;
					}

					for (Edge i : edges[j]) {
						if ((S & (1 << i.v)) != 0) {
							continue;
						}
						
						dp[i.v][S | (1 << i.v)] = Math.min(dp[i.v][S | (1 << i.v)], dp[j][S] + i.w);
					}
				}
			}
			
			for (int i = 0; i < v; i++) {
				for (Edge j : edges[i]) {
					if (j.v != s || j.w == INF || dp[i][(1 << v) - 1] == INF) {
						continue;
					}

					min = Math.min(min, dp[i][(1 << v) - 1] + j.w);
				}
			}
		}

		if (min != INF) {
			System.out.println(min);
		} else {
			System.out.println(-1);
		}

		sc.close();
	}

	private static class Edge {
//		int u; // from
		int v; // to
		int w; // cost
		
		Edge(int u, int v, int w) {
//			this.u = u;
			this.v = v;
			this.w = w;
		}
	}
}