#include <bits/stdc++.h>
using namespace std;
string s;
int n, h;
long double ans;
inline void print(long double x) {
  cout << fixed << setprecision(9) << x << endl;
}
int main() {
  cin >> s >> n >> h;
  if (s == "Alice") {
    ans = n;
    for (int j = 1; j < n; ++j) {
      long double tmp = 0, two = 1, f = 1;
      for (int i = 1; i <= h; ++i) {
        two /= 2, f *= 2;
        tmp += two / 2 * pow(1.L - two, j - 1) *
               (1 - (long double)(j - 1) / (f - 1));
      }
      ans += tmp * (n - j);
    }
    print(ans);
  } else
    print(n);
  return 0;
}
