#include <bits/stdc++.h>
using namespace std;
const int maxn = 30100;
int n, h;
long double p[35], qian[35];
long double pq[35][maxn];
int main() {
  std::ios::sync_with_stdio(false);
  string op;
  cin >> op;
  cin >> n >> h;
  if (op == "Bob" || h == 0) {
    printf("%d\n", n);
    return 0;
  }
  h++;
  p[1] = 0.5;
  for (int i = 2; i < h; i++) p[i] = p[i - 1] * 0.5;
  p[h] = p[h - 1];
  qian[0] = 0;
  for (int i = 1; i <= h; i++) qian[i] = qian[i - 1] + p[i];
  for (int i = 0; i <= h; i++) {
    pq[i][0] = 1;
    for (int j = 1; j <= n; j++) pq[i][j] = pq[i][j - 1] * qian[i];
  }
  long double ans = 0;
  for (int j = 2; j <= n; j++)
    for (int r = 1; r <= h; r++) {
      ans += (1 << (r - 1)) * pq[r][n - j] * p[r] * (1 - pq[r - 1][j - 1]) /
             (1 - qian[r - 1]) * (qian[h] - qian[r - 1]);
    }
  ans *= 2;
  long double sum = 0;
  for (int i = 2; i <= n; i++)
    for (int r = 1; r <= h; r++) {
      sum += (1 << (r - 1)) * pq[r][n - i] * p[r] * p[r] * (n - i + 1) *
             pq[r - 1][i - 2];
    }
  printf("%.10lf\n", (double)(ans - sum + 1));
  return 0;
}
