#include #define GET_MACRO(a, b, c, NAME, ...) NAME #define rep(...) GET_MACRO(__VA_ARGS__, rep3, rep2)(__VA_ARGS__) #define rep2(i, a) rep3 (i, 0, a) #define rep3(i, a, b) for (int i = (a); i < (b); i++) #define repr(...) GET_MACRO(__VA_ARGS__, repr3, repr2)(__VA_ARGS__) #define repr2(i, a) repr3 (i, 0, a) #define repr3(i, a, b) for (int i = (b) - 1; i >= (a); i--) #define chmin(a, b) ((b) < a && (a = (b), true)) #define chmax(a, b) (a < (b) && (a = (b), true)) using namespace std; typedef long long ll; struct edge { int v; double c; }; int N, M; vector g[20]; double dp[1 << 20][20]; double f(int s, int k) { if (k == 0) return 1.0; if (dp[s][k] >= 0) return dp[s][k]; double p = 1; for (auto e : g[k]) if (~s & 1 << e.v) { p *= 1.0 - f(s | 1 << e.v, e.v) * e.c; } return dp[s][k] = 1.0 - p; } int main() { cin >> N >> M; rep (i, M) { int A, B, C; cin >> A >> B >> C; g[B].push_back({A, C / 100.0}); } rep (i, 1 << 20) rep (j, 20) dp[i][j] = -1; double ans = f(1 << N - 1, N - 1); printf("%.20f\n", ans); return 0; }