#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int X,A,B;

	scanf("%d %d %d",&X,&A,&B);

	int num_query;
	scanf("%d",&num_query);

	char command[10];

	for(int loop = 0; loop < num_query; loop++){

		scanf("%s",command);

		switch(command[0]){
		case 'n':

			X += A;
			break;

		case 't':

			X += B;
			break;

		case 'k':

			X = 0;
			break;
		}

		X = max(0,X);
	}

	printf("%d\n",X);

	return 0;
}

