#include <bits/stdc++.h>
using namespace std;
int main() {
  string s[100];
  int n, p;
  while (cin >> n >> p) {
    for (int i = 0; i < n; i++) cin >> s[i];
    double num = 0, ans = 0;
    for (int i = n - 1; i >= 0; i--) {
      int len = s[i].size();
      if (len > 4 && i == n - 1) {
        ans = 0;
      } else if (i == n - 1) {
        ans = 1;
      }
      if (len > 4) {
        ans = (ans + 0.5) * 2.0, num += 0.5;
      } else {
        ans *= 2.0;
      }
    }
    printf("%.0lf", ((ans - num) * p));
  }
}
