#include <bits/stdc++.h>
using namespace std;
inline void in(register int &x) {
  register int f = 1;
  x = 0;
  char s = getchar();
  while (!isdigit(s)) {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (isdigit(s)) {
    x = x * 10 + s - '0';
    s = getchar();
  }
  x *= f;
}
int n;
double sum, p, tot;
char op[48][20];
int main() {
  in(n);
  scanf("%lf", &p);
  for (register int i = 1; i <= n; i++) scanf("%s", op[i] + 1);
  for (register int i = n; i >= 1; i--) {
    sum *= 2;
    if (op[i][5] == 'p') sum += 0.5;
    tot += sum;
  }
  printf("%.0f", tot * p);
}
