import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.string; alias Tuple!(int, "to", real, "p") Edge; int N, M; Edge[][] adj, rev; real[] mem; real dp(int n) { if (n == 0) return 0; if (mem[n] >= 0) return mem[n]; real ret = 1; foreach (m; rev[n]) { real q = dp(m.to); ret *= q + (1 - q) * (1 - m.p); } return mem[n] = ret; } void main() { auto s = readln.split.map!(to!int); N = s[0]; M = s[1]; adj = new Edge[][](N); rev = new Edge[][](N); foreach (i; 0..M) { s = readln.split.map!(to!int); adj[s[0]] ~= Edge(s[1], s[2]*0.01L); rev[s[1]] ~= Edge(s[0], s[2]*0.01L); } mem = new real[](N); fill(mem, -1); writefln("%.9f", 1 - dp(N-1)); //mem.writeln; //rev.each!writeln; }