#include <iostream>
#include <string>

using namespace std;
int main(){
	int i,n,a,b,x;
	cin >> x >> a >> b >> n;
	int now = x;
	for(i=0;i<n;i++){
		string s; cin >> s;
		if(s[0]=='n'){
			now += a;
			if(now<0) now = 0;
		}
		if(s[0]=='t'){
			now += b;
			if(now<0) now = 0;
		}
		if(s[0]=='k'){
			now = 0;
		}
	}
	cout << now << endl;
}
