#include <bits/stdc++.h>
using namespace std;
char s[15];
int n, m;
double b, t, ans = 0;
int main() {
  scanf("%s", s);
  scanf("%d%d", &n, &m);
  if (s[0] == 'B') return printf("%d", n), 0;
  for (int i = b = 1; i <= m; i++) {
    b *= 2;
    for (int j = t = 1; j <= n; j++)
      ans += (n - j) / b / 2 * t * (b - j) / (b - 1), t *= 1 - 1 / b;
  }
  printf("%.20lf\n", ans + n);
}
