#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int x, a, b; cin >> x >> a >> b;
  int n; cin >> n;
  while (n--) {
    string s; cin >> s;
    if (s[0] == 'n') {
      x = max(x + a, 0);
    } else if (s[0] == 't') {
      x = max(x + b, 0);
    } else {
      x = 0;
    }
  }
  cout << x << '\n';
}
