#include <bits/stdc++.h>
using namespace std;
int main() {
  ios ::sync_with_stdio(false);
  int T = 1;
  int cases = 0;
  while (T--) {
    cases++;
    int n, p;
    cin >> n >> p;
    vector<string> s(n);
    for (int i = 0; i < n; i++) {
      cin >> s[i];
    }
    reverse(s.begin(), s.end());
    long long int result = 0, apple = 0;
    for (int i = 0; i < n; i++) {
      apple *= 2;
      if (s[i].back() == 's') {
        apple += 1;
      }
      result += (1LL * p * apple) / 2;
    }
    cout << result;
  }
}
