import std.stdio, std.conv; import std.algorithm, std.range, std.random; import std.string, std.array, std.container, std.bigint; import std.typecons; int main() { int n, m; readf("%d %d\n", &n, &m); alias E = Tuple!(int, int, double); E[] g; foreach (i; 0..m) { int a, b; double c; readf("%d %d %f\n", &a, &b, &c); g ~= tuple(a, b, c); } double[] res = new double[](n); bool[] used = new bool[](n); res[0] = 1; used[0] = true; foreach (_ ; 0..2*n) { foreach (i; 0..n) { if (used[i]) continue; bool f = true; double sm = 1; foreach (e; g) { if (e[1] != i) continue; if (used[e[0]] == false) { f = false; break; } sm *= (1 - res[e[0]]*e[2] / 100.0); } if (!f) continue; res[i] = 1-sm; used[i] = true; } } if (used[n-1]) { writef("%.20f\n", res[n-1]); } else { writeln(0); } return 0; }