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