#include <bits/stdc++.h>
using namespace std;
int n, h;
char s[25];
int main() {
  scanf("%s%d%d", s, &n, &h);
  if (s[0] == 'B') return printf("%d\n", n), 0;
  double ans = n;
  for (int H = (int)(1); H <= (int)(h); H++)
    for (int j = (int)(1); j <= (int)(n - 1); j++) {
      double res = pow(2, H);
      res -= pow(2, H - 1) * (1 + (j - 1) / (pow(2, H) - 1));
      ans += pow(0.25, H) * pow(1 - pow(0.5, H), j - 1) * (n - j) * res;
    }
  printf("%.15lf\n", ans);
}
