#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; vector cnt(n + 1, 1); for (int i = 2; i <= n; i++) { for (int j = i; j <= n; j += i) { cnt[j]++; } } double ans = 0; for (int i = 2; i <= n; i++) { ans += pow(1 - p, cnt[i] - 2); } cout << fixed << setprecision(15) << ans << '\n'; }