#include #include #include #define double long double using namespace std; double getProOr( vector a ){ double ret = 0; int n = a.size(); for( int i = 1; i < (1<> j) & 1 ){ p *= a[j]; ucnt++; } } if( ucnt & 1 ) ret += p; else ret -= p; } return ret; } int n, m; vector et[20]; int efsize[20] = {0}; vector ec[20]; int main() { int i; cin >> n >> m; for( i = 0; i < m; i++ ){ int a, b, c; cin >> a >> b >> c; et[a].push_back(b); efsize[b]++; ec[a].push_back((double)c/100); } double pro[20] = {0}; vector pros[20]; pros[0].push_back(1); bool used_v[20] = {false}; while( m != 0 ){ for( i = 0; i < n; i++ ) if( efsize[i] == 0 && !used_v[i] ) break; if( i == n ) break; //頂点iについて計算 used_v[i] = true; pro[i] = getProOr( pros[i] ); //頂点iから伝搬 int v = i; for( i = 0; i < et[v].size(); i++ ){ pros[et[v][i]].push_back(pro[v] * ec[v][i]); efsize[et[v][i]]--; } m--; } cout << fixed << setprecision(14) << pro[n-1] << endl; return 0; }