#include using namespace std; typedef long long ll; typedef vector VI; typedef vector VVI; typedef vector VL; typedef vector VVL; typedef pair PII; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() #define MOD 1000000007 #define INF (1LL<<25) //33554432 #define PI 3.14159265359 #define EPS 1e-12 //#define int ll int a[1000010]; signed main(void) { int n; double p; cin >> n >> p; FOR(i, 2, n+1) for(int j=i*2; j<=n; j+=i) a[j]++; double ans = 0; FOR(i, 2, n+1) { if(a[i] == 0) ans += 1; else ans += pow((1-p), a[i]); } cout << fixed << setprecision(15) << ans << endl; return 0; }