#include <bits/stdc++.h>
using namespace std;
const int K = 103, N = 30005;
double f[K], sum[K];
double pr[N][K];
double mem[N][K];
int main() {
  string s;
  cin >> s;
  int n, H;
  cin >> n >> H;
  H++;
  if (s == "Bob") {
    cout << n << endl;
    return 0;
  }
  for (int i = 1; i <= H; i++) {
    if (i == H)
      f[i] = pow(2, -(i - 1));
    else
      f[i] = pow(2, -i);
    sum[i] = sum[i - 1] + f[i];
  }
  for (int i = 1; i <= n; i++)
    for (int t = 1; t <= H; t++)
      mem[i][t] = pow(sum[t], i - 1) - pow(sum[t - 1], i - 1);
  memset(pr, 0, sizeof pr);
  pr[1][0] = 1;
  for (int i = 2; i <= n; i++) {
    for (int h = 1; h <= H; h++) {
      double leftbigger = 1 - pow(sum[h], i - 1);
      double rightbigger = 1 - pow(sum[h], n - i);
      double skipped = leftbigger * rightbigger;
      double dd = skipped * f[h];
      pr[i][0] += dd;
      double sm = dd;
      for (int t = 1; t < h; t++) {
        double left = mem[i][t];
        pr[i][t] += left * f[h];
        sm += left * f[h];
      }
      pr[i][h] += f[h] - sm;
    }
  }
  double ans = 1;
  for (int i = 1; i <= n; i++)
    for (int h = 1; h <= H; h++) ans += pr[i][h] * pow(2, h - 1);
  cout << setprecision(15) << ans << endl;
}
