#define _USE_MATH_DEFINES #include using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; double p; cin >> p; vector a(n + 1); for (int i = 2; i <= n; i++) { int x = i; vector b; for (int j = 2; j * j <= x; j++) { int c = 0; while (x % j == 0) { c++; x /= j; } if (c != 0) b.push_back(c); } if (x != 1) b.push_back(1); int cnt = 1; for (auto &j : b) { cnt *= j + 1; } a[i] = cnt; } double ans = 0; for (int i = 2; i <= n; i++) { ans += pow(1.0 - p, a[i] - 2); } cout << setprecision(20) << fixed << ans << '\n'; return 0; }