#include <bits/stdc++.h>
using namespace std;
long double exp(long double x, int n) {
  long double ret = 1;
  while (n) {
    if (n & 1) ret = ret * x;
    x = x * x;
    n >>= 1;
  }
  return ret;
}
string S;
int N, H;
long double po[32];
int main() {
  po[0] = 1;
  for (int i = 1; i < 32; i++) {
    po[i] = po[i - 1] / 2;
  }
  cin >> S >> N >> H;
  if (S == "Bob") {
    printf("%d", N);
    return 0;
  }
  long double ans = N;
  for (int i = 1; i <= H; i++) {
    for (long double j = 1; j <= N; j++) {
      ans += (long double)(N - j) * exp(po[i], 2) * exp(1 - po[i], j - 1) *
             (exp(2, i) - exp(2, i - 1) * (1 + (j - 1) / (exp(2, i) - 1)));
    }
  }
  cout << fixed;
  cout.precision(20);
  cout << ans;
}
