#include <bits/stdc++.h>
const int maxn = 100005;
const int mod = 1000000007;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
using namespace std;
char s[10];
int n, h;
int main() {
  while (~scanf("%s", s + 1)) {
    scanf("%d%d", &n, &h);
    if (s[1] == 'B') {
      printf("%d\n", n);
      continue;
    }
    double ans = n;
    double mi = 1;
    for (int i = 1; i <= h; i++) {
      mi *= 2;
      double t = 1;
      for (int j = 1; j <= n; j++) {
        ans += (n - j) * 1.0 / (mi * mi) * t *
               (mi - mi / 2.0 * (1.0 + (j - 1) / (mi - 1)));
        t *= (1.0 - 1.0 / mi);
      }
    }
    printf("%.9lf\n", ans);
  }
  return 0;
}
