#include <vector>
#include <iostream>
#include <functional>
using namespace std;
int main() {
	int N;
	while (cin >> N, N) {
		vector<double> p(N);
		vector<vector<int> > g(N), rg(N);
		for (int i = 0; i < N; ++i) {
			int l;
			cin >> p[i] >> l;
			for (int j = 0; j < l; ++j) {
				int u;
				cin >> u; --u;
				g[i].push_back(u);
				rg[u].push_back(i);
			}
		}
		vector<bool> vis(N);
		vector<int> ord(N, -1), invord(N, -1);
		int cnt = 0;
		function<void(int)> dfs1 = [&](int pos) {
			vis[pos] = true;
			for (int i : g[pos]) {
				if (!vis[i]) dfs1(i);
			}
			ord[pos] = cnt;
			invord[cnt] = pos;
			++cnt;
		};
		for (int i = 0; i < N; ++i) {
			if (ord[i] == -1) {
				dfs1(i);
			}
		}
		cnt = 0;
		vector<int> col(N, -1);
		vector<int> vlist;
		function<bool(int)> dfs2 = [&](int pos) {
			col[pos] = cnt;
			vlist.push_back(pos);
			bool ans = true;
			for (int i : rg[pos]) {
				if (col[i] == -1) ans = ans && dfs2(i);
				else if (col[i] != cnt) ans = false;
			}
			return ans;
		};
		double ans = 1.0;
		for (int i = N - 1; i >= 0; --i) {
			if (col[invord[i]] != -1) continue;
			vlist.clear();
			bool res = dfs2(invord[i]);
			if (res) {
				double mul = 1.0;
				for (int j : vlist) mul *= p[j];
				ans *= 1.0 - mul;
			}
			++cnt;
		}
		cout.precision(15);
		cout << fixed << ans << endl;
	}
	return 0;
}
