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 sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

## 4/25

V, E = mi()
rel = [[] for _ in range(V)]
inv_rel = [[] for _ in range(V)]
for i in range(E):
    s, t, c = mi()
    rel[s].append((t, c))
    #inv_rel[t].append((s, c))

B = 2**V
dp = dp2(-1, V, B)

# 前向きメモ化再帰
def rec_for(state, now):
    if dp[state][now] != -1:
        return dp[state][now]
    if state == B-1:
        dp[state][now] = 0
        return 0
    res = float('inf')
    for v, c in rel[now]:
        if v==0 and state|(1<<v)!=B-1:
            continue
        if not state & (1<<v):
            res = min(res, rec_for(state|(1<<v), v)+c)
    dp[state][now] = res
    return res

# 後ろ向きメモ化再帰
def rec_back(state, now):
    if dp[state][now] != -1:
        return dp[state][now]
    if state==now==0:
        dp[state][now] = 0
        return 0
    res = float('inf')
    for pv, c in inv_rel[now]:
        if pv==0 and state!=1:
            continue
        if state & (1<<pv):
            res = min(res, rec_back(state^(1<<pv), pv)+c)
    dp[state][now] = res
    return res

ans = rec_for(0, 0)
#ans = rec_back(B-1, 0)
if ans == float('inf'):
    print(-1)
    exit()
print(ans)

'''
# DP
dp = dp2(float('inf'), V, B)
dp[0][0] = 0

for state in range(B-1):
    for now in range(V):
        if dp[state][now] != float('inf'):
            for nv, c in rel[now]:
                #if nv == 0 and state|1 != B-1:
                    #continue
                if not state & 1<<nv:
                    dp[state|(1<<nv)][nv] = min(dp[state|(1<<nv)][nv], dp[state][now]+c)

if dp[B-1][0] == float('inf'):
    print(-1)
    exit()
print(dp[B-1][0])
'''
