require 'tsort'
require 'set'

class Hash
    include TSort
    alias tsort_each_node each_key
    def tsort_each_child(u)
        self[u].each do |v|
            yield(v)
        end
    end
end

loop do
    n = gets.to_i
    break if n == 0
    g = {}
    sleep_prob = []
    n.times do |i|
        g[i] = Set.new
        q, _, *neighbours = gets.split.map(&:to_f)
        sleep_prob[i] = q
        neighbours.each do |j|
            g[i] << j.to_i - 1
        end
    end
    scc = g.strongly_connected_components
    dict = {}
    scc.each.with_index do |a, i|
        a.each do |j|
            dict[j] = i
        end
    end

    roots = Set[*(0..scc.size-1).to_a]
    g.each_key do |i|
        g[i].each do |j|
            next if dict[i] == dict[j]
            roots.delete(dict[j])
        end
    end

    ans = roots.map {|i| 1 - scc[i].map {|j| sleep_prob[j]}.inject(:*)}.inject(:*)
    printf("%.9f\n", ans)
end