#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
	int x,a,b;
	cin>>x>>a>>b;

	int n;cin>>n;
	int h=x;
	rep(i,n){
		string s;cin>>s;
		if(s[0]=='n')h+=a;
		else if(s[0]=='t')h+=b;
		else h=0;
		chmax(h,0ll);
	}
	cout<<h<<endl;
	return 0;
}
