#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector veci; typedef vector vecs; #define REP(i, a, n) for(ll i = a; i < n; i++) #define rep(i, n) REP(i, 0, n) template void read(T& a){cin >> a;} template void rarr(T a, int n){for(int i = 0; i < n; i++) {cin >> a[i];}} template void write(T a){cout << a << endl;} void write(double a){cout << fixed << setprecision(12) << a << endl;} template void warr(T a, int n, char* c = " "){cout << a[0];for(int i = 1; i < n; i++)cout << c << a[i];cout << endl;} int main(void) { int a[1000001] = {0}; int n; double p; read(n); read(p); REP(i, 2, n+1) { for(int j = i*2; j <= n; j += i) { a[j]++; } } double res = 0; REP(i, 2, n+1) res += pow(1-p, a[i]); write(res); return 0; }