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