N,P=gets.split.map(&:to_f) h=Hash.new(1) 2.upto(N.to_i){|i|(i*2).step(N.to_i,i){|j|h[j]*=1-P}} p (2..N.to_i).map{|e|h[e]}.reduce(:+)