import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void log(A...)(A arg) {
    stderr.writeln(arg);
}
int size(T)(in T s) {
    return cast(int)s.length;
}

class Graph {
    int V;
    int[][] g, rg;
    this(int V) {
        g = new int[][V];
        rg = new int[][V];
        this.V = V;
    }
    void addEdge(int from, int to) {
        g[from] ~= to;
        rg[to] ~= from;
    }
    /* ????????????????????????????????????????????? */
    int[] scc() {
        auto used = new bool[V];
        int[] vs;
        void dfs1(int v) {
            used[v] = true;
            foreach (u; g[v]) {
                if (used[u]) continue;
                dfs1(u);
            }
            vs ~= v;
        }
        void dfs2(int v, int k, int[] order) {
            used[v] = true;
            order[v] = k;
            foreach (u; rg[v]) {
                if (used[u]) continue;
                dfs2(u, k, order);
            }
        }
        foreach (v; 0 .. V) {
            if (used[v]) continue;
            dfs1(v);
        }
        used[] = false;
        int k = 0;
        auto ord = new int[V]; ord[] = -1;
        foreach_reverse (v; vs) {
            if (used[v]) continue;
            dfs2(v, k++, ord);
        }
        return ord;
    }
}

void main() {
    while (true) {
        int N; readf("%d\n", &N);
        if (N == 0) break;
        auto P = new real[N];
        auto g = new Graph(N);
        foreach (i; 0 .. N) {
            real p; int m; readf("%s %d", &p, &m);
            auto a = readln.strip.split(" ").map!((s) => s.to!int - 1);
            P[i] = p;
            foreach (x; a) {
                g.addEdge(i, x);
            }
        }
        auto ord = g.scc();
        auto used = new bool[N];
        void dfs(int v) {
            foreach (u; g.g[v]) {
                if (used[u]) continue;
                used[u] = true;
                dfs(u);
            }
        }
        real ans = 1.0;
        foreach (int k; 0 .. ord.reduce!max + 1) {
            foreach (i; 0 .. N) {
                if (ord[i] != k) continue;
                real p = 1.0;
                if (used[i]) continue;
                foreach (j; 0 .. N) {
                    if (ord[i] == ord[j]) {
                        p *= P[j];
                    }
                }
                ans *= 1.0 - p;
                used[i] = true;
                dfs(i);
            }
        }
        writefln("%.9f", ans);
    }
}