#include <bits/stdc++.h>
using namespace std;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
inline int myrand() { return abs((rand() << 15) ^ rand()); }
inline int rnd(int x) { return myrand() % x; }
void alice(int N, int hmax) {
  long double res = N;
  for (int h = 1; h <= hmax; ++h) {
    long double cur = (long double)1 / (1ll << (2 * h));
    for (int len = 1; len < N; ++len) {
      res += (N - len) * cur *
             ((1 << h) -
              (1 << (h - 1)) * (1 + (long double)(len - 1) / ((1 << h) - 1)));
      cur *= 1 - (long double)1 / (1 << h);
    }
  }
  printf("%.18f\n", (double)res);
}
void bob(int n, int h) { printf("%d\n", n); }
bool solve() {
  char s[10];
  int n, h;
  if (scanf("%s%d%d", s, &n, &h) < 3) return 0;
  if (!strcmp(s, "Alice")) {
    alice(n, h);
    return 1;
  }
  assert(!strcmp(s, "Bob"));
  bob(n, h);
  return 1;
}
int main() {
  srand(rdtsc());
  while (1) {
    if (!solve()) break;
  }
  return 0;
}
