#include using namespace std; using ll = long long; template using min_priority_queue = priority_queue, greater>; using pii = pair; using pll = pair; using Graph = vector>; const ll INF = 1LL << 60; template void chmax(T& a, T b) { if (b > a) a = b; } template void chmin(T& a, T b) { if (b < a) a = b; } template std::ostream& operator<<(std::ostream& os, const pair& x) noexcept { return os << "(" << x.first << ", " << x.second << ")"; } template void print_vector(vector a) { cout << '['; for (int i = 0; i < a.size(); i++) { cout << a[i]; if (i != a.size() - 1) { cout << ", "; } } cout << ']' << endl; } ll gcd(ll x, ll y) { return (x % y) ? gcd(y, x % y) : y; } ll lcm(ll x, ll y) { return x / gcd(x, y) * y; } ll ceilll(ll x, ll y) { return (x + y - 1) / y; } ll mod(ll x, ll y) { return (x + 10000000) % y; } // 約数全列挙 vector all_divisors(ll K) { vector ret; for (ll i = 1; i * i <= K; i++) { if (K % i != 0) continue; ret.push_back(i); if (i * i != K) ret.push_back(K / i); } return ret; } // 素因数分解 vector> prime_factorize(ll N) { vector> res; for (ll a = 2; a * a <= N; ++a) { if (N % a != 0) continue; ll ex = 0; while (N % a == 0) { ++ex; N /= a; } res.push_back({a, ex}); } if (N != 1) res.push_back({N, 1}); return res; } double memo[10000000]; double powdouble(double a, ll x) { if (x == 0) return 1; if (memo[x]) return memo[x]; memo[x] = powdouble(a, x - 1) * a; return memo[x]; } int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); ll N; cin >> N; double p; cin >> p; double ret = 0; for (int i = 2; i <= N; i++) { auto tmp = all_divisors(i); // print_vector(tmp); ret += powdouble(1 - p, tmp.size() - 2); } std::cout << fixed << setprecision(12) << ret << "\n"; return 0; }