#include <bits/stdc++.h>
using namespace std;
char s[20];
int n, h;
int main() {
  scanf("%s%d%d", s, &n, &h);
  if (s[0] == 'B')
    printf("%d\n", n);
  else {
    double ans = n, p = 1.0;
    for (int i = 1; i <= h; i++) {
      p *= 2;
      double t = 1.0, res = 0.0;
      for (int l = 1; l <= n - 1; l++) {
        res += (n - l) * t * (p - (p / 2) * (1.0 + (l - 1) / (p - 1)));
        t *= (1 - 1 / p);
      }
      ans += res / (p * p);
    }
    printf("%.10lf\n", ans);
  }
}
