#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

using Graph = vector<vector<int>>;

// O(|V| + |E|)
struct SCC
{
    int V, K;
    Graph G, rG;
    vector<int> vs;
    vector<bool> used;
    vector<int> cmp;
    SCC(int _V) : V(_V), G(_V), rG(_V), used(_V, false), cmp(_V) {}
    void add_edge(int from, int to)
    {
        G[from].push_back(to);
        rG[to].push_back(from);
    }
    void dfs(int cur)
    {
        used[cur] = true;
        for (const auto &v : G[cur])
        {
            if (!used[v])
                dfs(v);
        }
        vs.push_back(cur);
    }
    void rdfs(int cur, int k)
    {
        used[cur] = true;
        cmp[cur] = k;
        for (const auto &v : rG[cur])
        {
            if (!used[v])
                rdfs(v, k);
        }
    }
    vector<int> scc()
    {
        for (int i = 0; i < V; i++)
            used[i] = false;
        vs.clear();
        for (int v = 0; v < V; v++)
        {
            if (!used[v])
                dfs(v);
        }
        for (int i = 0; i < V; i++)
            used[i] = false;
        int k = 0;
        for (int i = (int)vs.size() - 1; i >= 0; i--)
        {
            if (!used[vs[i]])
                rdfs(vs[i], k++);
        }
        K = k;
        return cmp;
    }
    Graph buildGraph()
    {
        scc();
        vector<set<int>> s(K);
        Graph ret(K);
        for (int v = 0; v < V; v++)
        {
            for (const auto to : G[v])
            {
                s[cmp[v]].insert(cmp[to]);
            }
        }
        for (int i = 0; i < K; i++)
        {
            for (auto j : s[i])
            {
                if (i != j)
                    ret[i].push_back(j);
            }
        }
        return ret;
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    while (cin >> N, N)
    {
        SCC scc(N);
        vector<double> p(N);
        for (int i = 0; i < N; i++)
        {
            cin >> p[i];
            int m;
            cin >> m;
            for (int j = 0; j < m; j++)
            {
                int a;
                cin >> a;
                a--;
                scc.add_edge(i, a);
            }
        }
        vector<int> cmp = scc.scc();
        Graph g = scc.buildGraph();
        int K = g.size();
        vector<int> in(K);
        for (int i = 0; i < K; i++)
        {
            for (const auto &next : g[i])
            {
                in[next]++;
            }
        }
        vector<vector<int>> v(K);
        for (int i = 0; i < N; i++)
        {
            v[cmp[i]].push_back(i);
        }
        double res = 1;
        for (int i = 0; i < K; i++)
        {
            if (in[i])
                continue;
            double x = 1;
            for (auto cur : v[i])
            {
                x *= p[cur];
            }
            res *= (1.0 - x);
        }
        cout << fixed << setprecision(10) << res << endl;
    }
}



Measured memory_bytes: 3444