#include <bits/stdc++.h>
const int N = 55;
class Matrix {
 public:
  double a[N][N];
  double *operator[](int i) { return a[i]; }
  friend Matrix operator*(Matrix &a, Matrix &b);
};
double a[N][N], b[N][N];
double f[N][N];
Matrix res, tr;
double p;
int n, tmp;
int main() {
  scanf("%d %d", &n, &tmp);
  p = tmp / 1e9;
  for (int i = 1; i <= 50; ++i) a[i][1] = p, a[i][2] = b[i][2] = 1 - p;
  for (int i = 2; i <= 50; ++i) {
    for (int j = 2; j <= 50; ++j) {
      a[i][j] += a[i][j - 1] * a[i - 1][j - 1];
      b[i][j] += b[i][j - 1] * a[i - 1][j - 1];
    }
  }
  for (int i = 50; i >= 2; --i) {
    for (int j = 1; j <= 50; ++j) {
      a[i][j] *= (1 - a[i - 1][j]);
      b[i][j] *= (1 - a[i - 1][j]);
    }
  }
  f[1][1] = 1, f[1][2] = 2;
  for (int i = 2; i <= 50; ++i) {
    for (int j = 2; j <= 50; ++j) {
      double s = 0;
      for (int k = 1; k < j; ++k)
        f[i][j] += f[i - 1][k] * a[i - 1][k], s += a[i - 1][k];
      f[i][j] = f[i][j] / s + j;
    }
    double s = 0;
    for (int k = 2; k <= 50; ++k)
      f[i][1] += f[i - 1][k] * b[i - 1][k], s += b[i - 1][k];
    f[i][1] = f[i][1] / s + 1;
  }
  if (n <= 50) {
    double ans = 0;
    for (int i = 1; i <= n + 1; ++i) ans += f[n][i] * a[n][i];
    std::cout << std::endl;
    std::cout.precision(14);
    std::cout << std::fixed << ans << std::endl;
    return 0;
  }
  res[0][0] = tr[0][0] = 1;
  for (int i = 1; i <= 50; ++i) res[0][i] = f[50][i], tr[0][i] = i;
  for (int i = 2; i <= 50; ++i) {
    double s = 0;
    for (int j = 1; j < i; ++j) tr[j][i] = a[50][j], s += a[50][j];
    for (int j = 1; j < i; ++j) tr[j][i] /= s;
  }
  double s = 0;
  for (int j = 1; j <= 50; ++j) tr[j][1] = b[50][j], s += b[50][j];
  for (int j = 1; j <= 50; ++j) tr[j][1] /= s;
  n -= 50;
  while (n) {
    if (n & 1) res = res * tr;
    tr = tr * tr;
    n >>= 1;
  }
  double ans = 0;
  for (int i = 1; i <= 50; ++i) ans += res[0][i] * a[50][i];
  std::cout.precision(14);
  std::cout << std::fixed << ans << std::endl;
  return 0;
}
Matrix operator*(Matrix &a, Matrix &b) {
  Matrix ans;
  memset(ans.a, 0, sizeof(ans.a));
  for (int i = 0; i <= 50; ++i) {
    for (int k = 0; k <= 50; ++k) {
      for (int j = 0; j <= 50; ++j) {
        ans[i][j] += a[i][k] * b[k][j];
      }
    }
  }
  return ans;
}
