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