#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) std::cout<<(p)<>N>>M; int a,b,c; rep(i,N)rep(j,N)rg[i][j]=0; rep(i,M){ cin>>a>>b>>c; rg[a][b] = c; } //dp[1024][9] rep(i,1024)rep(k,9)dp[i][k]=-1; int ans = solve(0,0,N,-1); P(ans); return 0; }