#include <bits/stdc++.h>
using namespace std;
double dp[35][35], f[35], ppl[30010][35], pl[35], pe[35], pow2[35], sum[35],
    s[35][35], sum2[35][35];
int m;
void process() {
  sum[0] = 0;
  for (int H = (1); H <= (m); H++) sum[H] *= pl[H - 1];
  memset(s, 0, sizeof s);
  for (int L = (0); L <= (m); L++)
    for (int H = (0); H <= (L); H++) s[L][H] = dp[L][H];
  for (int L = (m); L >= (0); L--)
    for (int H = (m); H >= (0); H--)
      s[L][H] += s[L + 1][H] + s[L][H + 1] - s[L + 1][H + 1];
  for (int H = (0); H <= (m); H++) sum[H] += s[H][H + 1];
  for (int L = (0); L <= (m); L++) {
    sum2[L][0] = dp[L][0];
    for (int H = (1); H <= (L); H++)
      sum2[L][H] = sum2[L][H] * pl[H - 1] + dp[L][H];
  }
}
void lemon() {
  int n;
  string buf;
  cin >> buf >> n >> m;
  ;
  if (buf == "Bob") {
    cout << n << endl;
    return;
  }
  if (m)
    pe[0] = 0.5;
  else
    pe[0] = 1;
  for (int i = (1); i <= (m - 1); i++) pe[i] = pe[i - 1] / 2;
  if (m) pe[m] = pe[m - 1];
  pl[0] = pe[0];
  for (int i = (1); i <= (m); i++) pl[i] = pl[i - 1] + pe[i];
  for (int i = (0); i <= (m); i++) ppl[0][i] = 1;
  for (int i = (1); i <= (n); i++)
    for (int j = (0); j <= (m); j++) ppl[i][j] = ppl[i - 1][j] * pl[j];
  pow2[0] = 1;
  for (int i = (1); i <= (m); i++) pow2[i] = pow2[i - 1] * 2;
  for (int i = (0); i <= (m); i++) dp[m][i] = pe[i];
  memset(sum, 0, sizeof sum);
  memset(sum2, 0, sizeof sum2);
  process();
  double ans = 1;
  for (int i = (2); i <= (n); i++) {
    memset(dp, 0, sizeof dp);
    for (int L = (0); L <= (m); L++) {
      memset(f, 0, sizeof f);
      f[L] += sum[L];
      for (int H = (0); H <= (L); H++) f[H] += sum2[L][H];
      for (int H = (0); H <= (L); H++) {
        double t = pl[L];
        if (H) t -= pl[H - 1];
        ans += f[H] * pow2[H] * t * ppl[n - i][L];
      }
      dp[L][0] = f[0];
      for (int H = (1); H <= (L); H++) dp[L][H] = dp[L][H - 1] + f[H];
      for (int H = (0); H <= (L); H++) dp[L][H] *= pe[H];
    }
    process();
  }
  printf("%.16lf\n", ans);
}
int main() {
  ios::sync_with_stdio(true);
  lemon();
  return 0;
}
