#include typedef long long ll; using namespace std; int INF = 1LL << 30; int MOD = 1e9+7; /* template struct P{ int count[max_N]; //size_t counter = 0; constexpr P() : count() { for(int i = 2; i <= max_N; ++i){ for(int j = i; j <= max_N; j += i){ count[j]++; } } } }; */ int cnt[1000010]; main(){ //constexpr auto c = P<10010>(); for(int i = 2;i <= 100000;i++){ for(int j = i*2;j <= 1000000;j += i){ cnt[j]++; } } int N; double p; cin >> N >> p; double ans = 0; for(int i = 2;i <= N;i++){ if(cnt[i] == 0)ans += 1; else ans += std::pow(1 - p, (double)cnt[i]); } printf("%.9lf\n" ,ans); }