#include <bits/stdc++.h>
using namespace std;
int n;
double p, A[55][55], B[55][55], _A[55][55], _B[55][55], F[55][55];
struct mat {
  double a[55][55];
  mat(int d = 0) {
    memset(a, 0, sizeof a);
    for (int i = (0), LIM = (50); i <= LIM; i++) a[i][i] = d;
  }
  mat operator*(const mat &B) const {
    mat r(0);
    for (int i = (0), LIM = (50); i <= LIM; i++)
      for (int j = (0), LIM = (50); j <= LIM; j++)
        for (int k = (0), LIM = (50); k <= LIM; k++)
          r.a[i][k] += a[i][j] * B.a[j][k];
    return r;
  }
} M, f;
mat Pow(mat b, int k) {
  mat r(1);
  for (; k; k >>= 1, b = b * b)
    if (k & 1) r = r * b;
  return r;
}
int main() {
  scanf("%d%lf", &n, &p);
  p /= 1e9;
  for (int i = (1), LIM = (50); i <= LIM; i++) {
    A[i][1] = p, B[i][2] = 1 - p, A[i][2] = A[i][1] * A[i - 1][1] + B[i][2];
    for (int j = (3), LIM = (50); j <= LIM; 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 = (1), LIM = (50); i <= LIM; i++) {
    _A[i][1] = A[i][1] * (1 - A[i - 1][1]);
    for (int j = (2), LIM = (50); j <= LIM; j++) {
      _A[i][j] = A[i][j] * (1 - A[i - 1][j]);
      _B[i][j] = B[i][j] * (1 - A[i - 1][j]);
    }
  }
  for (int i = (1), LIM = (50); i <= LIM; i++) F[1][i] = i;
  for (int i = (2), LIM = (50); i <= LIM; i++) {
    double x = 0, y = 0;
    for (int j = (2), LIM = (50); j <= LIM; j++)
      x += F[i - 1][j] * _B[i - 1][j], y += _B[i - 1][j];
    F[i][1] = x / y + 1;
    for (int j = (2), LIM = (50); j <= LIM; j++) {
      x = 0, y = 0;
      for (int k = (1), LIM = (j - 1); k <= LIM; k++)
        x += F[i - 1][k] * _A[i - 1][k], y += _A[i - 1][k];
      F[i][j] = x / y + j;
    }
  }
  if (n <= 50) {
    double ans = 0;
    for (int i = (1), LIM = (50); i <= LIM; i++) ans += F[n][i] * _A[n][i];
    printf("%lf\n", ans);
    return 0;
  }
  double y = 0;
  for (int j = (2), LIM = (50); j <= LIM; j++) y += _B[50][j];
  for (int j = (2), LIM = (50); j <= LIM; j++) M.a[j][1] += _B[50][j] / y;
  for (int j = (1), LIM = (50); j <= LIM; j++) M.a[0][j] = j;
  M.a[0][0] = 1;
  for (int j = (2), LIM = (50); j <= LIM; j++) {
    y = 0;
    for (int k = (1), LIM = (j - 1); k <= LIM; k++) y += _A[50][k];
    for (int k = (1), LIM = (j - 1); k <= LIM; k++) M.a[k][j] += _A[50][k] / y;
  }
  M = Pow(M, n - 50);
  for (int i = (1), LIM = (50); i <= LIM; i++) f.a[0][i] = F[50][i];
  f.a[0][0] = 1;
  f = f * M;
  double ans = 0;
  for (int i = (1), LIM = (50); i <= LIM; i++) ans += f.a[0][i] * _A[50][i];
  printf("%lf\n", ans);
}
