#include <bits/stdc++.h>
using namespace std;
double a[55][55], b[55][55];
int n;
double P;
double f[55][55];
struct matrix {
  double a[55][55];
  int l1, l2;
  matrix operator*(const matrix &A) const {
    matrix ret;
    memset(ret.a, 0, sizeof(ret.a));
    ret.l1 = l1;
    ret.l2 = A.l2;
    for (int i = 1; i <= ret.l1; i++) {
      for (int j = 1; j <= ret.l2; j++) {
        for (int k = 1; k <= l2; k++) ret.a[i][j] += a[i][k] * A.a[k][j];
      }
    }
    return ret;
  }
} x, z, fn;
int main() {
  int i, j, k;
  scanf("%d%lf", &n, &P);
  P /= 1e9;
  a[1][1] = P;
  a[1][2] = 1.0 - P;
  b[1][2] = 1.0 - P;
  for (i = 2; i < 50; i++) {
    a[i][1] = P;
    a[i][2] = 1.0 - P;
    b[i][2] = 1.0 - P;
    for (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];
    }
  }
  if (n < 50) {
    f[1][1] = 1;
    f[1][2] = 2;
    for (i = 2; i <= n; i++) {
      double sum = 0.0;
      for (k = 2; k <= i; k++) {
        f[i][1] += f[i - 1][k] * b[i - 1][k] * (1.0 - a[i - 2][k]);
        sum += b[i - 1][k] * (1.0 - a[i - 2][k]);
      }
      f[i][1] /= sum;
      f[i][1] += 1.0;
      for (j = 2; j <= 50; j++) {
        sum = 0.0;
        for (k = 1; k < j; k++) {
          f[i][j] += f[i - 1][k] * a[i - 1][k] * (1.0 - a[i - 2][k]);
          sum += a[i - 1][k] * (1.0 - a[i - 2][k]);
        }
        f[i][j] /= sum;
        f[i][j] += j;
      }
    }
    double ans = 0.0;
    for (i = 1; i <= n + 1; i++) ans += a[n][i] * (1.0 - a[n - 1][i]) * f[n][i];
    printf("%.10lf\n", ans);
  } else {
    f[1][1] = 1;
    f[1][2] = 2;
    for (i = 2; i < 50; i++) {
      double sum = 0.0;
      for (k = 2; k <= i; k++) {
        f[i][1] += f[i - 1][k] * b[i - 1][k] * (1.0 - a[i - 2][k]);
        sum += b[i - 1][k] * (1.0 - a[i - 2][k]);
      }
      f[i][1] /= sum;
      f[i][1] += 1.0;
      for (j = 2; j <= 50; j++) {
        sum = 0.0;
        for (k = 1; k < j; k++) {
          f[i][j] += f[i - 1][k] * a[i - 1][k] * (1.0 - a[i - 2][k]);
          sum += a[i - 1][k] * (1.0 - a[i - 2][k]);
        }
        f[i][j] /= sum;
        f[i][j] += j;
      }
    }
    double sum = 0.0;
    x.l1 = x.l2 = 51;
    for (i = 2; i <= 50; i++) sum += b[49][i] * (1.0 - a[49][i]);
    for (i = 2; i <= 50; i++) x.a[i][1] = b[49][i] * (1.0 - a[49][i]) / sum;
    for (i = 2; i <= 50; i++) {
      sum = 0.0;
      for (j = 1; j < i; j++) sum += a[49][j] * (1.0 - a[49][j]);
      for (j = 1; j < i; j++) x.a[j][i] = a[49][j] * (1.0 - a[49][j]) / sum;
    }
    for (i = 1; i <= 50; i++) x.a[51][i] = i;
    x.a[51][51] = 1;
    z.l1 = z.l2 = 51;
    for (i = 1; i <= 51; i++) z.a[i][i] = 1;
    int k = n - 49;
    while (k) {
      if (k & 1) z = z * x;
      x = x * x;
      k >>= 1;
    }
    fn.l1 = 1;
    fn.l2 = 51;
    for (i = 1; i <= 50; i++) fn.a[1][i] = f[49][i];
    fn.a[1][51] = 1;
    fn = fn * z;
    double ans = 0.0;
    for (i = 1; i <= 50; i++) ans += a[49][i] * (1.0 - a[49][i]) * fn.a[1][i];
    printf("%.10lf\n", ans);
  }
  return 0;
}
