#include <bits/stdc++.h>
inline unsigned int getuint() {
  char w = getchar();
  while (w < '0' || '9' < w) w = getchar();
  unsigned int ans = 0;
  for (; '0' <= w && w <= '9'; w = getchar()) ans = ans * 10 + w - '0';
  return ans;
}
inline char getletter() {
  char w = getchar();
  while (w < 'A' || 'Z' < w) w = getchar();
  return w;
}
int main() {
  if (getletter() == 'B') return printf("%u\n", getuint()), 0;
  int n = getuint(), m = getuint();
  double ans = n, i2 = 1;
  for (int i = 1; i <= m; i++) {
    i2 *= 2;
    double tmp = 0, k = 1 - 1 / i2, now = 1;
    for (int j = 1; j <= n; j++, now *= k)
      tmp += (n - j) * now * 0.5 * (1 - (j - 1) / (i2 - 1));
    ans += tmp / i2;
  }
  printf("%.9f\n", ans);
  return 0;
}
