#include <bits/stdc++.h>
using namespace std;
const int MAXN = 30030, MAXH = 33;
int N, H;
int main() {
  cout << setprecision(18);
  string person;
  cin >> person;
  cin >> N >> H;
  if (person == "Bob")
    cout << N << endl;
  else {
    double ans = N;
    for (int h = 1; h <= H; h++) {
      for (int l = 1; l < N; l++) {
        double ph = pow(2, -h);
        double pw = ph * ph * pow(1 - ph, l - 1);
        double est = pow(2, h);
        double punder = 1.0 / (pow(2, h) - 1);
        double num = punder * (l - 1);
        double prev_est = pow(2, h - 1) * (1 + num);
        ans += (N - l) * pw * (est - prev_est);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
