class Calc0066 EPS = 1e-6 def initialize(args) args = args.map { |l| l.chomp.split(/\s+/) } @m = args.shift.first.to_i @ss = args.map(&:first).map(&:to_i) @memo = Array.new(2 ** @m) { [1] + Array.new(@m) } end def calc(i, k) @memo[i][k] = (members(i, k) - members(i, k - 1)).map { |j| @memo[j][k - 1] * win_p(i, j) }.inject(:+) * @memo[i][k - 1] end def members(i, k) s = (i / 2 ** k) ((s * 2 ** k)...((s + 1) * 2 ** k)).to_a end def win_p(i, j) (@ss[i] ** 2).to_f / (@ss[i] ** 2 + @ss[j] ** 2) end def run (1..@m).each do |k| (0...(2 ** @m)).each do |i| calc(i, k) end end @memo[0][@m] end end puts Calc0066.new(STDIN.readlines).run if __FILE__ == $0