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 ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};
ll n,e;
vvl(d,20,20,inf);
ll dp[1 << 15][20];

ll rec(ll s, ll v){
  //?????????????????????????????§?????????????????????
  if(dp[s][v] >= 0){
    return dp[s][v];
  }
  //??????????????????????¨?????????????
  if(s == (1 << n) - 1 && v == 0){
    return dp[s][v] = 0;
  }
  ll res = inf;
  rep(u,n){
    //???????§???????????????????????????????????????????
    if( !(s >> u & 1) && d[v][u] != 0){
      res = min(res,rec(s | 1 << u, u) + d[v][u]);
    }
  }
  return dp[s][v] = res;
}

void solve(){
  memset(dp,-1,sizeof(dp));
  ll ans = rec(0,0);
  if(ans == inf) ans = -1;
  cout << ans<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> e;
  ll s,t,dis;
  rep(i,e){
    cin >> s >> t >> dis;
    d[s][t] = dis;
  }
  solve();
  return 0;
}