#include <bits/stdc++.h>
using namespace std;
char s[25];
int N, H;
int main() {
  scanf("%s", s);
  scanf("%d%d", &N, &H);
  if (s[0] == 'B')
    printf("%d\n", N);
  else {
    double Tmp = N, t = 1;
    for (int i = 1; i <= H; i++) {
      t *= 0.5;
      double cur = 1, p = 1 - t;
      for (int l = 1; l <= N; l++) {
        Tmp = Tmp + (N - l) * t * cur * (1 - 0.5 * (1 + (l - 1) / (1 / t - 1)));
        cur *= p;
      }
    }
    printf("%.13f\n", Tmp);
  }
}
