#include <cstdio>
#include <algorithm>
#include <numeric>
using namespace std;
double dp[1000010];
int main()
{
    int n;
    double p;
    while (~scanf("%d%lf", &n, &p)) {
        fill(dp, dp+n+1, 1);
        for(int i=2;i<=n;++i) for(int j=i+i;j<=n;j+=i) dp[j]*=1-p;
        printf("%.10f\n", accumulate(dp+2, dp+n+1, 0.0));
    }
}