#include #define EM 1000000 using namespace std; using LL = long long; using P = pair; LL LINF = 1e18; int INF = 1e9; LL mod = 1e9+7; using vint = vector; using vLL = vector; using vvint = vector>; using vvLL = vector>; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } int main(){ int N; double p; cin >> N >> p; vint a(N+1, 0); vector P(N+1, 1); for(int i = 1;i <= N;i++) P[i] = (1-p) * P[i-1]; for(int i = 2;i <= N;i++){ for(int j = i;j <= N;j += i){ a[j]++; } } double ans = 0; for(int i = 2;i <= N;i++){ if(a[i] == 1) ans += (double) 1; else ans += P[a[i]-1]; } cout << setprecision(20) << ans << endl; }