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