#include <bits/stdc++.h>
using namespace std;
char name[22];
int n, h;
double ans;
int main() {
  scanf("%s", name);
  scanf("%d %d", &n, &h);
  ans = n;
  if (name[0] == 'A') {
    for (int j = 1; j <= h; ++j) {
      double z = 1.0;
      for (int l = 1; l < n; ++l) {
        ans += 1.0 * (n - l) / (1 << j) / (1 << j) * z *
               (0.0 + (1 << j) -
                1.0 * (1 << j - 1) * (1.0 + 1.0 * (l - 1) / ((1 << j) - 1)));
        z *= (1.0 - (1.0 / (1 << j)));
      }
    }
  }
  printf("%.12lf\n", ans);
}
