#include <bits/stdc++.h>
using namespace std;
char name[20] = "\0";
int N, H;
long double power(long double a, long long k) {
  long double o = 1;
  for (; k > 0; k >>= 1) {
    if (k & 1) o = o * a;
    a = a * a;
  }
  return o;
}
int main() {
  scanf("%s", name);
  cin >> N >> H;
  if (strcmp(name, "Bob") == 0)
    printf("%d\n", N);
  else {
    double Ans = N;
    for (int i = 1; i <= H; i++)
      for (int j = 1; j <= N; j++) {
        Ans += (double)(N - j) / (1ll << (2 * i)) *
               power(1 - (double)1 / (1 << i), j - 1) *
               ((1 << i) -
                (1 << (i - 1)) * (1 + (double)(j - 1) / ((1 << i) - 1)));
      }
    printf("%.10lf\n", Ans);
  }
  return 0;
}
