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