#include using namespace std; #ifdef LOCAL #include "debug.hpp" #else #define debug(...) 1 #endif int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; double p; cin >> p; double ans = 0; for (int i = 2; i <= n; i++) { int cnt = 0; for (int j = 2; j * j <= i; j++) { if (i % j == 0) { cnt++; if (j != i / j) { cnt++; } } } ans += pow(1 - p, cnt); } cout << fixed << setprecision(15) << ans << '\n'; }