#include <bits/stdc++.h>
using namespace std;
const int N = 30005;
int n, m;
char opt[10];
double p[N], pre[N], f[N];
inline double ksm(double x, int y) {
  double ans = 1;
  for (; y; y >>= 1, x = x * x)
    if (y & 1) ans *= x;
  return ans;
}
void solve1() {
  scanf("%d%d", &n, &m);
  m++;
  p[0] = 1;
  for (int i = 1; i <= m; i++)
    p[i] = p[i - 1] * 0.5, pre[i] = pre[i - 1] + p[i];
  for (int i = 0; i <= m; i++) f[i] = 1;
  p[m] *= 2;
  pre[m] = 1;
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++)
      ans += (j == 0 ? 0 : f[j] - f[j - 1]) * (1 - (j == 0 ? 0 : pre[j - 1])) *
             (1 << j - 1);
    for (int j = 0; j <= m; j++) f[j] *= pre[j];
  }
  ans *= 2;
  if (n > 1)
    for (int i = 1; i < n; i++)
      for (int j = 1; j <= m; j++)
        ans -= ksm(pre[j - 1], i - 1) * ksm(pre[j], n - i - 1) * (1 << j - 1) *
               p[j] * p[j] * (n - i);
  printf("%.10lf\n", ans + 1);
}
void solve2() {
  int n;
  scanf("%d", &n);
  printf("%d\n", n);
}
int main() {
  scanf("%s", opt);
  if (opt[0] == 'A')
    solve1();
  else
    solve2();
}
