#include<bits/stdc++.h>
using namespace std;
long long a[10],t=0,s=0;
char c[100010];
bool z=0;
int main(){
for(int i=0;i<10;i++) scanf("%lld",&a[i]);
scanf("%s",&c);
for(long long i=0;i<strlen(c);i++){
if(z==0){
if(c[i]=='W') s+=3;
if(c[i]=='E') s+=6;
if(c[i]=='R') t+=a[9];
else z=1;
}
else if(z==1){
z=0;
if(c[i]=='W') s+=1;
if(c[i]=='E') s+=2;
if(c[i]!='R') t+=a[s];
s=0;
}
}
printf("%lld",t);
return 0;
}
TLE力