#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() template inline bool chmax(A &a, B b) { if (a inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; } typedef unsigned long long ull; typedef long long ll; typedef pair pii; typedef pair pll; typedef pair P; const ll INF = 1ll<<60; const ll MOD = 1000000007; const double EPS = 1e-10; int n; double p, pp[10000]; int cnt[1123456]; int main() { cin >> n >> p; FOR(i, 1, n + 1) { for (int j = i; j <= n; j += i) { cnt[j]++; } } pp[0] = 1; FOR(i, 1, 10000) pp[i] = pp[i - 1] * (1 - p); double ans = 0.0; FOR(i, 2, n + 1) ans += pp[cnt[i] - 2]; printf("%.15f\n", ans); return 0; }