#include <bits/stdc++.h>
using namespace std;
double n, h;
char c[10];
double ans;
double ksm(double x, long long y) {
  double maretu = 1.0;
  for (; y; y >>= 1) {
    if (y & 1) {
      maretu *= x;
    }
    x *= x;
  }
  return maretu;
}
int main() {
  scanf("%s", c);
  if (c[0] == 'A') {
    scanf("%lf%lf", &n, &h);
    ans = n;
    for (double i = 1; i <= h; ++i) {
      for (double j = 1; j <= n; ++j) {
        ans +=
            (n - j) * (1.0 / (double)(1LL << (long long)(2 * i))) *
            ksm(1.0 - (1.0 / (double)(1LL << (long long)i)),
                (long long)(j - 1.0)) *
            ((double)(1LL << ((long long)i)) -
             (double)(1LL << (long long)(i - 1)) *
                 (1.0 + (j - 1.0) / ((double)(1LL << (long long)(i)) - 1.0)));
      }
    }
    printf("%.10lf", ans);
  } else {
    scanf("%lf%lf", &n, &h);
    printf("%lf", n);
  }
  return 0;
}
