Problem: Your friend recently gave you some slimes for your birthday. You have a very large amount of slimes with value 1 and 2, and you decide to invent a game using these slimes.

You initialize a row with n empty spaces. You also choose a number p to be used in the game. Then, you will perform the following steps while the last space is empty. 

  1. With probability <image>, you will choose a slime with value 1, and with probability <image>, you will choose a slime with value 2. You place the chosen slime on the last space of the board. 
  2. You will push the slime to the left as far as possible. If it encounters another slime, and they have the same value v, you will merge the slimes together to create a single slime with value v + 1. This continues on until the slime reaches the end of the board, or encounters a slime with a different value than itself. 



You have played the game a few times, but have gotten bored of it. You are now wondering, what is the expected sum of all values of the slimes on the board after you finish the game.

Input

The first line of the input will contain two integers n, p (1 ≤ n ≤ 109, 1 ≤ p < 109).

Output

Print the expected sum of all slimes on the board after the game finishes. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 4.

Namely, let's assume that your answer is a and the answer of the jury is b. The checker program will consider your answer correct, if <image>.

Examples

Input

2 500000000


Output

3.562500000000000


Input

10 1


Output

64.999983360007620


Input

100 123456789


Output

269.825611298854770

Note

In the first sample, we have a board with two squares, and there is a 0.5 probability of a 1 appearing and a 0.5 probability of a 2 appearing.

Our final board states can be 1 2 with probability 0.25, 2 1 with probability 0.375, 3 2 with probability 0.1875, 3 1 with probability 0.1875. The expected value is thus (1 + 2)·0.25 + (2 + 1)·0.375 + (3 + 2)·0.1875 + (3 + 1)·0.1875 = 3.5625.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
clock_t t = clock();
namespace my_std {
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
inline T rnd(T l, T r) {
  return uniform_int_distribution<T>(l, r)(rng);
}
template <typename T>
inline bool chkmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmin(T &x, T y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
inline void read(T &t) {
  t = 0;
  char f = 0, ch = getchar();
  double d = 0.1;
  while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
  while (ch <= '9' && ch >= '0') t = t * 10 + ch - 48, ch = getchar();
  if (ch == '.') {
    ch = getchar();
    while (ch <= '9' && ch >= '0') t += d * (ch ^ 48), d *= 0.1, ch = getchar();
  }
  t = (f ? -t : t);
}
template <typename T, typename... Args>
inline void read(T &t, Args &...args) {
  read(t);
  read(args...);
}
char __sr[1 << 21], __z[20];
int __C = -1, __zz = 0;
inline void Ot() { fwrite(__sr, 1, __C + 1, stdout), __C = -1; }
inline void print(register int x) {
  if (__C > 1 << 20) Ot();
  if (x < 0) __sr[++__C] = '-', x = -x;
  while (__z[++__zz] = x % 10 + 48, x /= 10)
    ;
  while (__sr[++__C] = __z[__zz], --__zz)
    ;
  __sr[++__C] = '\n';
}
void file() {}
inline void chktime() {}
long long ksm(long long x, int y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x)
    if (y & 1) ret = ret * x;
  return ret;
}
}  // namespace my_std
using namespace my_std;
const int m = 50;
int n;
long double p;
long double P[3333], pp[3333];
void work(long double *F, long double *G, int n) {
  static long double f[3333][m + 5], g[3333][m + 5];
  memset(f, 0, sizeof(f)), memset(g, 0, sizeof(g));
  for (int i = (1); i <= (min(m, n + 1)); i++) f[1][i] = F[i], g[1][i] = G[i];
  for (int i = (2); i <= (n); i++)
    for (int j = (1); j <= (min(n - i + 2, m)); j++) {
      for (int k = (j + 1); k <= (m); k++) {
        long double w = (j == n - i + 2 ? pp[j] : P[j]);
        if (i == n) w = (j == 1 ? p : 1 - p);
        f[i][j] += f[i - 1][k] * w;
        g[i][j] += w * (g[i - 1][k] + f[i - 1][k] * j);
      }
      long double w;
      if (j == 2)
        w = 1 - p;
      else if (j == 1)
        w = 0;
      else if (j != n - i + 2)
        w = pp[j];
      else
        w = pp[j - 1] * pp[j - 1];
      f[i][j] += f[i - 1][1] * w;
      g[i][j] += w * (g[i - 1][1] + f[i - 1][1] * j);
    }
  long double ans = 0;
  for (int i = (1); i <= (m); i++) ans += g[n][i];
  cout << setprecision(17) << ans << '\n';
}
long double f[3333][m + 5], g[3333][m + 5], tmp1[m + 5], tmp2[m + 5];
int main() {
  file();
  read(n, p), p /= 1e9;
  if (n == 1) return cout << setprecision(17) << p + 2 * (1 - p) << '\n', 0;
  P[1] = p, P[2] = 1 - p + p * p;
  for (int i = (3); i <= (m); i++) {
    P[i] = P[i - 1] * P[i - 1];
    if (P[i] < 1e-12) break;
  }
  pp[2] = 1 - p;
  for (int i = (3); i <= (m); i++) {
    pp[i] = pp[2];
    for (int j = (2); j <= (i - 1); j++) pp[i] *= P[j];
    if (pp[i] < 1e-12) break;
  }
  for (int i = (1); i <= (min(m, n)); i++) f[1][i] = P[i], g[1][i] = P[i] * i;
  if (n + 1 <= m) f[1][n + 1] = pp[n + 1], g[1][n + 1] = pp[n + 1] * (n + 1);
  if (n <= 2000) return work(f[1], g[1], n), 0;
  for (int i = (2); i <= (1500); i++)
    for (int j = (1); j <= (m); j++) {
      for (int k = (j + 1); k <= (m); k++) {
        long double w = P[j];
        f[i][j] += f[i - 1][k] * w;
        g[i][j] += w * (g[i - 1][k] + f[i - 1][k] * j);
      }
      long double w = pp[j];
      f[i][j] += f[i - 1][1] * w;
      g[i][j] += w * (g[i - 1][1] + f[i - 1][1] * j);
    }
  int nn = n - 1500 - 100;
  for (int i = (1); i <= (m); i++) tmp1[i] = f[1500][i];
  for (int i = (1); i <= (m); i++)
    tmp2[i] = g[1500][i] + (g[1500][i] - g[1499][i]) * nn;
  work(tmp1, tmp2, 101);
  return 0;
}