//Author Ruchir #include using namespace std; #define rep(i,n) for(int i=0;i #define pii pair #define f first #define mp make_pair #define s second #define pb push_back int a[29];int maxx=0; int main(){ rep(i,26)cin>>a[i]; string s ;cin>>s; int len=s.size(); rep(i,len){ int x=s[i]-'a'; maxx=max(maxx,a[x]);} cout<