#include <bits/stdc++.h>
char s[9];
int n, h;
double G, a = 1, b = 1;
int main() {
  scanf("%s%d%d", s, &n, &h);
  if (*s == 'A')
    for (int i = 1; i <= h; i++) {
      a /= 4;
      b *= 2;
      for (int j = 1; j <= n; j++)
        G += (n - j) * a * pow(1 - 1 / b, j - 1) *
             (b - b / 2 * (1 + (j - 1) / (b - 1)));
    }
  printf("%.9f", G + n);
}
