#include <bits/stdc++.h>
using namespace std;
const int MAXN = 30000 + 10, MAXH = 30 + 5;
int n, h;
char str[10];
void solveA() {
  double Tohka = 0;
  for (int i = 1; i <= h; ++i)
    for (int j = 1; j <= n; ++j)
      Tohka += (double)(n - j) * pow(0.5, i * 2) *
               pow(1 - 1.0 / (1 << i), j - 1) *
               ((double)(1 << i) -
                (1 << (i - 1)) * (1.0 + (double)(j - 1) / ((1 << i) - 1)));
  printf("%.10lf\n", Tohka + n);
}
int main() {
  scanf("%s", str);
  cin >> n >> h;
  if (str[0] == 'A')
    solveA();
  else
    cout << n << endl;
  fclose(stdin);
  fclose(stdout);
  return 0;
}
