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
from collections import defaultdict


# 頂点がn個, 辺がw個の場合
n, w = map(int, input().split())

INF = 1 << 60
graph = defaultdict(lambda: INF)

for _ in range(w):
    a, b, c = map(int, input().split())
    graph[(a, b)] = c

# -1でdpテーブルを初期化。bitで集合を管理するので1<<n（状態数） * n（curr）
dp = [[-1] * n for _ in range(1 << n)]


# 既に訪れた集合がs, curr=vの時に0に戻る最短経路を計算
def rec(s, v):
    # 既に計算されている場合はそのまま返す（メモ化再帰）
    if dp[s][v] >= 0:
        return dp[s][v]

    # 全ての頂点を訪問済みで、かつcurr=0の場合は0を返す
    if s == (1 << n) - 1 and v == 0:
        return 0

    # INFで初期化
    res = INF

    # sが現在の状態なので、1つずつ右シフトで読んでいく。未訪問（=0）の場合に処理
    # 最初は全て未訪問
    for u in range(n):
        if not (s >> u & 1):
            # 未訪問を1つずつ潰していくイメージ。uまで訪問していて、curr=uの場合を計算
            # 1回計算された結果はメモ化再帰で再利用
            res = min(res, rec(s | (1 << u), u) + graph[(v, u)])

    dp[s][v] = res
    return dp[s][v]


ans = rec(0, 0)

print(-1 if ans == INF else ans)
