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