#include <bits/stdc++.h>
using namespace std;
typedef double dblmat[1034 + 1][68 + 1];
int n, x, i, j, k, I;
double p, q, ans, tmp;
dblmat a, b, f;
int main() {
  scanf("%d%d", &n, &x);
  p = (double)x * 0.000000001;
  q = 1.0 - p;
  for (i = 1; i <= 1034; i++)
    for (j = 1; j <= 68; j++) {
      a[i][j] = (j == 1 ? p : j == 2 ? q : 0.0);
      a[i][j] += a[i][j - 1] * a[i - 1][j - 1];
      b[i][j] = (j == 2 ? q : 0.0);
      b[i][j] += b[i][j - 1] * a[i - 1][j - 1];
    }
  for (i = 1034; i > 1; i--)
    for (j = 1; j <= 68; ++j) {
      a[i][j] *= 1 - a[i - 1][j];
      b[i][j] *= 1 - a[i - 1][j];
    }
  for (j = 0; j <= 68; j++) f[0][j] = j;
  for (i = 1; i < 1034; i++) {
    for (k = 2; k <= 68; k++) f[i][1] += b[i][k] * f[i - 1][k];
    f[i][1] = 1.0 + f[i][1] / q;
    for (j = 2; j <= 68; j++) {
      tmp = 0.0;
      for (k = 1; k < j; k++) {
        f[i][j] += a[i][k] * f[i - 1][k];
        tmp += a[i][k];
      }
      f[i][j] = (double)j + f[i][j] / tmp;
    }
  }
  if (n <= 1034) {
    ans = 0.0;
    for (i = 1; i <= 68; i++) ans += a[n][i] * f[n - 1][i];
  } else {
    ans = tmp = 0;
    for (i = 1; i <= 68; i++) {
      ans += a[1034][i] * f[1034 - 1][i];
      tmp += a[1034 - 1][i] * f[1034 - 2][i];
    }
    ans += (ans - tmp) * (n - 1034);
  }
  printf("%.15lf\n", ans);
  return 0;
}
