import scala.annotation.tailrec
import scala.collection.{immutable, mutable}
object Main extends App {
  import scala.io.StdIn._

  loop()
  @tailrec def loop(): Unit = {
    val n = readInt()
    if (n == 0) return
    val member = Array.fill(n) {
      val prob :: m :: list = readLine.trim.split(' ').toList
      (prob.toDouble, list.map(_.toInt - 1))
    }
    val inverseEdge = Array.fill(n) {Nil: List[Int]}
    for (i ← member.indices; j ← member(i)._2) inverseEdge(j) ::= i
    val lastTime = Array.fill(n) {0}
    val isDiscovery = Array.fill(n) {false}
    def setLastTIme(current: Int, time: Int = 0): Int = {
      if (!isDiscovery(current)) {
        isDiscovery(current) = true
        lastTime(current) = member(current)._2.foldLeft(time) { case (t, next) ⇒ setLastTIme(next, t) } + 1
        lastTime(current)
      } else time
    }
    (0 until n).foldLeft(0){case (t, r) ⇒ setLastTIme(r, t)}
    isDiscovery.indices.foreach(i ⇒ isDiscovery(i) = false)
    val union = new UnionFind(n + 1)
    def mergeStrongConnect(current: Int): Unit = {
      isDiscovery(current) = true
      for (next ← inverseEdge(current) if !isDiscovery(next)) {
        union.merge(current, next)
        mergeStrongConnect(next)
      }
    }
    for (i ← lastTime.indices.sortBy(lastTime)(Ordering.Int.reverse) if !isDiscovery(i)) {
      mergeStrongConnect(i)
    }
    var result = 1d
    val inEdgeCount= inverseEdge.indices.map(i ⇒ inverseEdge(i).count(j ⇒ !union.isSame(i, j)))
    for (i ← inverseEdge.indices if !union.isSame(i, n)) {
      var res = 1d
      var inEdge = 0
      for (j ← 0 until n if union.isSame(i, j)) {
        res *= member(j)._1
        inEdge += inEdgeCount(j)
      }
      if (inEdge == 0) result *= (1 - res)
      union.merge(i, n)
    }
    println(f"$result%.9f")
    loop()
  }
}
class UnionFind(val size: Int) {
  private[this] val array = Array.fill(size){-1}
  def find(a: Int): Int = {
    if (array(a) < 0) a
    else {
      array(a) = find(array(a))
      array(a)
    }
  }
  def isSame(a: Int, b: Int): Boolean = find(a) == find(b)
  def merge(a: Int, b: Int): Unit = {
    val ar = find(a)
    val br = find(b)
    if (ar != br){
      if (array(ar) < array(br)) {
        array(ar) += array(br)
        array(br) = ar
      }else {
        array(br) += array(ar)
        array(ar) = br
      }
    }
  }
}
