#include <bits/stdc++.h>
using namespace std;
char s[10];
int n, h;
int main() {
  scanf("%s", s);
  scanf("%d%d", &n, &h);
  if (s[0] == 'B')
    printf("%d\n", n);
  else {
    double ans = n;
    double ph = 0.5, pc = 0.5;
    for (int i = 1; i <= h; i++) {
      double pn = 0.5;
      for (int j = 0; j < n - 1; j++) {
        ans += (n - j - 1) * ph * (1 - j * ph / pc) * pn;
        pn *= 1 - ph;
      }
      ph /= 2.0;
      pc += ph;
    }
    printf("%.10lf\n", ans);
  }
  return 0;
}
