#include <iostream>
#include <string>

using namespace std;

int main() {
	int x, a, b; cin >> x >> a >> b;
	int n; cin >> n;
	while (n--) {
		string s; cin >> s;
		if (s == "nobiro") x += a;
		else if (s == "tidime") x += b;
		else x = 0;
		if (x < 0) x = 0;
	}
	cout << x << endl;

	return 0;
}
