#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
long double a[55][55], b[55][55], dp[2222][55];
long double p;
long double solve(int n) {
  long double ans = 0, tmp, v;
  dp[1][1] = 1;
  dp[1][2] = 2;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= 50; j++) {
      tmp = 0;
      dp[i][j] = 0;
      if (j == 1) {
        for (int k = 2; k <= 50; k++) {
          v = b[min(50, i - 1)][k] * (1 - a[min(50, i - 2)][k]);
          tmp += v;
          dp[i][j] += dp[i - 1][k] * v;
        }
      } else {
        for (int k = 1; k <= j - 1; k++) {
          v = a[min(50, i - 1)][k] * (1 - a[min(50, i - 2)][k]);
          tmp += v;
          dp[i][j] += dp[i - 1][k] * v;
        }
      }
      dp[i][j] /= tmp;
      dp[i][j] += j;
    }
  }
  for (int i = 1; i <= 50; i++)
    ans += dp[n][i] * a[min(n, 50)][i] * (1 - a[min(50, n - 1)][i]);
  return ans;
}
int main() {
  int n, pp;
  cin >> n >> pp;
  p = (long double)pp / 1000000000;
  a[1][1] = p;
  a[1][2] = 1 - p;
  b[1][2] = 1;
  for (int i = 2; i <= 50; i++) {
    a[i][1] = p;
    a[i][2] = 1 - p;
    b[i][2] = 1;
    for (int j = 2; j <= 50; j++) {
      a[i][j] += a[i][j - 1] * a[i - 1][j - 1];
      if (j != 2) b[i][j] = b[i][j - 1] * a[i - 1][j - 1];
    }
  }
  if (n <= 1000) {
    printf("%.10lf\n", (double)solve(n));
  } else {
    printf("%.10lf\n",
           (double)(solve(999) + (n - 999) * (solve(1000) - solve(999))));
  }
  return 0;
}
