#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define MAX_V 1000
int V,cmp[MAX_V];
vector<int> G[MAX_V],rG[MAX_V],vs,a,xx;
int used[MAX_V];
void addedge(int from,int to){
  G[from].push_back(to);
  rG[to].push_back(from);
} 
void dfs(int v){
  used[v]=1;
  for(int i=0;i<G[v].size();i++)
    if(!used[G[v][i]])dfs(G[v][i]);
  vs.push_back(v);
}
void rdfs(int v,int k){
  used[v]=1;
  cmp[v]=k;
  for(int i=0;i<rG[v].size();i++){
    if(!used[rG[v][i]])rdfs(rG[v][i],k);
  }
}
void dfs2(int v,int k){
  used[v]=k;
  for(int i=0;i<G[v].size();i++)
    if(!used[G[v][i]])dfs(G[v][i]);
  xx.push_back(v);
}
int scc(){
  int pp=0;
  memset(used,0,sizeof(used));
  vs.clear();
  for(int v=0;v<V;v++)
    if(!used[v])dfs(v);
  memset(used,0,sizeof(used));
  int k=1;
  for(int i=vs.size()-1;i>=0;i--)
    if(!used[vs[i]]){
      rdfs(vs[i],k++);
    }
  k=1;
  map<int,int>m;
  memset(used,0,sizeof(used));
  for(int i=vs.size()-1;i>=0;i--){
    if(!used[vs[i]]){
      dfs(vs[i]);
      r(j,xx.size())if(used[xx[j]]!=k){
        m[used[xx[j]]]=0;
      }
      m[vs[i]]=cmp[vs[i]];
      k++;
    }
  }
  r(i,V)if(m[i])
    a.push_back(m[i]);
  return k;
}
int main(){
  int x,y;
  while(cin>>V,V){
    double d[V],ans=0;
    a.clear();
    r(i,1000)G[i].clear(),rG[i].clear();
    r(i,V){
      cin>>d[i]>>x;
      r(j,x){
        cin>>y;
        addedge(i,y-1);
      }
    }
    scc();
    int cnt=0;
    r(i,a.size()){
      double p=0;
      int c=0;
      r(j,V)if(cmp[j]==a[i]){
        if(!c++)p+=d[j];
        else p*=d[j];
      }
      if(!cnt++)ans+=(1.0-p);
      else ans*=(1.0-p);
    }
    printf("%.9f\n",ans);
  }
}