SS = gets.split N = SS[0].to_i P = SS[1].to_f A = Array.new(N + 1, -1) for n in 2..N do m = n while m <= N do A[m] += 1 m += n end end sum = 0 TBL = {} for n in 2..N do p = TBL[n] TBL[n] = p = (1 - P) ** A[n] unless p sum += p end puts sum