class Yukicoder def initialize n, m = gets.chomp.split(' ').map(&:to_f) n = n.to_i list = Array.new(n+1, 1.0) list[0] = 0 list[1] = 0 2.upto(n) do |num| (2*num).step(n, num) do |k| list[k] *= (1.0 - m) end end puts list.inject(:+) end end Yukicoder.new