#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); for (int i = 2; i <= n; i++) { int x = i; int c = 0; for (int j = 1; j * j <= x; j++) { if (x % j == 0) { if (x / j == j) c++; else c += 2; } } a[i] = c; } 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; }