#include using namespace std; #define N 1000100 int p[N]; double r[N]; int main(){ int n; double q; cin>>n>>q; for(int i = 2; i <= n/2; i++) for(int j = i*2; j <= n; j+=i) p[j]++; r[0] = 1.0; for(int i = 1; i <= n; i++) r[i] = r[i-1]*(1.0-q); double res = 0; for(int i = 2; i <= n; i++) res += r[p[i]]; cout.precision(9); cout<