#pragma GCC optimize("Ofast") #include #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define rep_r(i,n) for(ll i=(ll)(n)-1;i>=0;i--) #define rep2(i,sta,n) for(ll i=sta;i<(ll)(n);i++) #define rep2_r(i,sta,n) for(ll i=(ll)(n)-1;i>=sta;i--) #define all(v) (v).begin(),(v).end() #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair P; typedef pair LP; typedef map LM; typedef tuple LT; typedef vector vi; typedef vector vvi; typedef vector vl; typedef vector vvl; typedef vector vvvl; typedef vector vlp; typedef vector vvlp; typedef vector vs; typedef vector vvs; typedef vector vd; typedef vector vvd; typedef vector vb; const int INF = numeric_limits::max() / 2 - 1e6; const ll LINF = LLONG_MAX / 2 - 1e6; const double DINF = numeric_limits::infinity(); using A = ll; template A iquery(Q q, string str = "? ") { cout << str << q << "\n"; cout.flush(); A a; cin >> a; return a; } template void ianswer(A a, string str = "! ") { cout << str << a << "\n"; cout.flush(); } struct RandGen { using ud = uniform_int_distribution; mt19937 mt; RandGen() : mt(chrono::steady_clock::now().time_since_epoch().count()) {} ll lint(ll a, ll b) { ud d(a, b - 1); return d(mt); } vl vlint(ll l, ll a, ll b) { ud d(a, b - 1); vl ret(l); rep(i, l) ret[i] = d(mt); return ret; } vl vlperm(ll l) { vl perm(l); iota(all(perm), 1); random_shuffle(all(perm)); return perm; } string saz(ll l, ll a = 0, ll z = 26) { vl az = vlint(l, a, z); string s; rep(i, l) s.pb('a' + az[i]); return s; } string snum(ll l, ll zero = 0, ll ten = 10) { vl zt = vlint(l, zero, ten); string s; rep(i, l) s.pb('0' + zt[i]); return s; } }; int ceil_pow2(ll n) { int x = 0; while ((1ULL << x) < (unsigned long long)(n)) x++; return x; } int floor_pow2(ll n) { int x = 0; while ((1ULL << (x + 1)) <= (unsigned long long)(n)) x++; return x; } ll POW(ll x, int n) { assert(n >= 0); ll res = 1; for(; n; n >>= 1, x *= x) if(n & 1) res *= x; return res; } ll sqrt_ceil(ll x) { ll l = -1, r = x; while (r - l > 1) { ll m = (l + r) / 2; if (m * m >= x) r = m; else l = m; } return r; } template T ceil(T x, S y) { assert(y); return (y < 0 ? ceil(-x, -y) : (x > 0 ? (x + y - 1) / y : x / y)); } template T floor(T x, S y) { assert(y); return (y < 0 ? floor(-x, -y) : (x > 0 ? x / y : (x - y + 1) / y)); } template void uniq(vector&a){ sort(all(a)); a.erase(unique(all(a)), a.end()); } template void comp(vector&a){ vector b = a; uniq(b); rep(i, a.size()) a[i] = lower_bound(all(b), a[i]) - b.begin(); } template void coutarray(vector& v, int offset = 0) { rep(i, v.size()) { if (i > 0) cout << " "; cout << v[i] + offset; } cout << "\n"; } template void coutmatrix(vector>& v) { rep(i, v.size()) { rep(j, v[i].size()) { if (j > 0) cout << " "; cout << v[i][j]; } cout << "\n";} } template void coutmap(map & m) { for (const auto& kv : m) { cout << kv.first << ":" << kv.second << " "; } cout << "\n"; } template void coutbin(T &a, int d) { for (int i = d - 1; i >= 0; i--) cout << ((a >> i) & (T)1); cout << "\n"; } template bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1;} return 0; } template bool chmax(T &a, const T &b) { if (b > a) { a = b; return 1;} return 0; } template int lbs(vector &a, const T &b) { return lower_bound(all(a), b) - a.begin(); }; template int ubs(vector &a, const T &b) { return upper_bound(all(a), b) - a.begin(); }; vl dx = {1, 0, -1, 0}; vl dy = {0, -1, 0, 1}; void solve() { ll N; cin >> N; ld p; cin >> p; vd prob(N + 1, 1); rep2(i, 2, N) { for (ll x = 2 * i; x <= N; x += i) { prob[x] *= 1 - p; } } // coutarray(prob); cout << fixed << setprecision(7) << accumulate(prob.begin() + 2, prob.end(), 0.0) << "\n"; } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t = 1; //cin >> t; while (t--) solve(); }