#include #include #include #include using namespace std; #define rep(i, S, E) for(int i=(S); i<=(E); i++) int main() { int N; double p; cin >> N >> p; p = 1 - p; vector M; M.resize(N+1, 1); double answer = 0; rep(i, 2, N){ answer += M[i]; for(int j=2; i*j<=N; j++){ M[i*j] *= p; } } printf("%.10f", answer); return 0; }