#include <bits/stdc++.h>
using namespace std;
string name;
int n, h;
int main() {
  cin >> name;
  scanf("%d%d", &n, &h);
  if (name == "Bob") {
    printf("%d\n", n);
    return 0;
  }
  long double ans = 0, pw2 = 1;
  for (int i = 1; i <= h; i++) {
    pw2 *= 2;
    long double tmp = 1;
    for (int j = 1; j <= n; j++) {
      ans += (n - j) / pw2 / 2 * tmp * (pw2 - j) / (pw2 - 1);
      tmp *= 1 - 1 / pw2;
    }
  }
  printf("%.10Lf\n", ans + n);
  return 0;
}
