import numpy as np N,p = input().split() N = int(N); p = float(p) dp = np.zeros(N+1, np.int32) for i in range(1, int(N**.5)+10): if i * i > N: break dp[i*i]+=1 dp[i*(i+1):N+1:i] += 2 dp -= 2 ans = 0 for i in range(2,N+1): ans += (1-p)**(dp[i]) print(ans)