#include <bits/stdc++.h>
using namespace std;
int N;
double p, q, a[51][51], dp[2][51];
void solve() {
  for (int i = 0; i < 51; ++i) {
    for (int k = 1; k < 51; ++k) {
      if (i == 0)
        a[i][k] = 0;
      else if (k == 1)
        a[i][k] = p;
      else if (i == 1 && k == 2)
        a[i][k] = q;
      else if (i > 1 && k == 2)
        a[i][k] = p * p + q;
      else if (i == 1 && k > 2)
        a[i][k] = 0;
      else
        a[i][k] = a[i][k - 1] * a[i - 1][k - 1];
    }
  }
  int iter = min(1500, N);
  for (int i = iter; i > 0; --i) {
    for (int j = 1; j < 51; ++j) {
      dp[0][j] = j;
      if (i < iter) {
        int rev = min(iter - i, 51 - 1);
        double num = 0;
        double denom = 0;
        if (j == 1) {
          for (int k = 2; k < 51; ++k) {
            double prob = a[rev][k] * (1 - a[rev - 1][k]);
            num += prob * dp[1][k];
            denom += prob;
          }
        } else if (j > 1) {
          for (int k = 1; k < j; ++k) {
            double prob = a[rev][k] * (1 - a[rev - 1][k]);
            num += prob * dp[1][k];
            denom += prob;
          }
        }
        dp[0][j] += num / denom;
      }
    }
    swap(dp[0], dp[1]);
  }
}
int main() {
  int x;
  scanf("%d %d", &N, &x);
  p = (double)x / 1000000000;
  q = 1 - p;
  solve();
  double ans = 0;
  int i = min(51 - 1, N);
  int sur = max(0, N - 1500);
  for (int k = 1; k <= 50; ++k) {
    ans +=
        a[i][k] * (1 - a[i - 1][k]) * (dp[1][k] + sur * (dp[1][k] - dp[0][k]));
  }
  printf("%.15f\n", ans);
  return 0;
}
