#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1.01e9;
const double eps = 1e-9;
char s[111][11];
int main() {
  int n, p;
  scanf("%d%d", &n, &p);
  for (int i = 0; (i) < (n); ++i) scanf("%s", s[i]);
  long long have = 0;
  long long res = 0;
  for (int i = n - 1; i >= 0; --i) {
    have = 2 * have;
    res += have;
    if (s[i][4] == 'p') {
      res++;
      have++;
    }
  }
  res = res * p / 2;
  printf("%I64d\n", res);
  return 0;
}
