#include "bits/stdc++.h" using namespace std; using ll = long long; using ld = double; using P = pair; constexpr ld EPS = 1e-12; constexpr int INF = numeric_limits::max() / 2; constexpr int MOD = 1e9 + 7; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; ld p; cin >> N >> p; vector divs(N + 1, 0); for (int i = 1; i <= N; i++) { for (int j = i; j <= N; j += i) { divs[j]++; } } vector dp(N + 1, 1); ld res = 0; for (int i = 2; i <= N; i++) { dp[i] = pow((1.0 - p), divs[i] - 2); res += dp[i]; } cout << fixed << setprecision(10) << res << endl; }