#include <bits/stdc++.h>
const int MAXN = 60;
double pr1[MAXN + 5][MAXN + 5], pr2[MAXN + 5][MAXN + 5];
double f[MAXN + 5][MAXN + 5], g[MAXN + 5][MAXN + 5];
double dp[MAXN + 5][MAXN + 5];
struct matrix {
  double m[MAXN + 5][MAXN + 5];
  int r, c;
} M, R;
void init(double p) {
  pr1[1][1] = p, pr1[2][1] = 1 - p;
  f[1][1] = p, f[2][1] = 1 - p, g[2][1] = 1;
  for (int i = 2; i <= MAXN; i++) {
    pr1[1][i] = p, pr1[2][i] = (1 - p) + p * p, pr2[2][i] = 1;
    for (int j = 3; j <= MAXN; j++)
      pr1[j][i] = pr1[j - 1][i] * pr1[j - 1][i - 1],
      pr2[j][i] = pr2[j - 1][i] * pr1[j - 1][i - 1];
    for (int j = 1; j <= MAXN; j++)
      f[j][i] = pr1[j][i] * (1 - pr1[j][i - 1]),
      g[j][i] = pr2[j][i] * (1 - pr1[j][i - 1]);
  }
  dp[1][1] = 1, dp[2][1] = 2;
  for (int i = 2; i <= MAXN; i++) {
    double del = 0;
    dp[1][i] = 1;
    for (int l = 1; l <= 50; l++) del += g[l][i - 1];
    for (int k = 1; k <= MAXN; k++)
      dp[1][i] += dp[k][i - 1] * g[k][i - 1] / del;
    del = 0;
    for (int j = 2; j <= MAXN; j++) {
      dp[j][i] = j;
      del += f[j - 1][i - 1];
      for (int k = 1; k < j; k++) dp[j][i] += dp[k][i - 1] * f[k][i - 1] / del;
    }
  }
  M.r = M.c = MAXN + 1;
  double del = 0;
  for (int i = 1; i <= MAXN; i++) del += g[i][MAXN];
  for (int i = 1; i <= MAXN; i++) M.m[1][i] = g[i][MAXN] / del;
  del = 0;
  for (int i = 2; i <= MAXN; i++) {
    del += f[i - 1][MAXN];
    for (int j = 1; j < i; j++) M.m[i][j] = f[j][MAXN] / del;
    for (int j = i; j <= MAXN; j++) M.m[i][j] = 0;
  }
  for (int i = 1; i <= MAXN; i++) M.m[0][i] = 0, M.m[i][0] = i;
  M.m[0][0] = 1;
  R.r = MAXN + 1, R.c = 1;
  for (int i = 1; i <= MAXN; i++) R.m[i][0] = dp[i][MAXN];
  R.m[0][0] = 1;
}
matrix operator*(matrix A, matrix B) {
  matrix C;
  C.r = A.r, C.c = B.c;
  for (int i = 0; i < C.r; i++)
    for (int j = 0; j < C.c; j++) C.m[i][j] = 0;
  for (int i = 0; i < A.r; i++)
    for (int j = 0; j < B.c; j++)
      for (int k = 0; k < A.c; k++) C.m[i][j] += A.m[i][k] * B.m[k][j];
  return C;
}
matrix quick_pow(matrix b, int p) {
  matrix ret;
  ret.r = ret.c = b.r;
  for (int i = 0; i < ret.r; i++)
    for (int j = 0; j < ret.c; j++) ret.m[i][j] = (i == j);
  while (p) {
    if (p & 1) ret = ret * b;
    b = b * b;
    p >>= 1;
  }
  return ret;
}
int main() {
  int n, p;
  scanf("%d%d", &n, &p);
  init(p / 1E9);
  if (n <= MAXN) {
    double ans = 0;
    for (int i = 1; i <= MAXN; i++) ans += f[i][n] * dp[i][n];
    printf("%lf\n", ans);
  } else {
    R = quick_pow(M, n - MAXN) * R;
    double ans = 0;
    for (int i = 1; i <= MAXN; i++) ans += f[i][MAXN] * R.m[i][0];
    printf("%lf\n", ans);
  }
}
