#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define f(i,a,b) for(ll i=a;i=b;i--) #define ff(i,a,b,c) for(int i=a;i0) #define vi vector #define vll vector typedef pair P; typedef pair ,int> PII; typedef pair ,long long int> PLL; typedef pair PL; typedef long long ll; typedef long double ld; typedef int I; typedef string S; ll gcd(ll n,ll m){if(m<=n && n%m==0)return m;if(nn-r)r=n-r;f(i,1,r+1)ans=(ans*(n-i+1))/(i);return ans;} ll mul(ll a,ll b,ll mod){a%=mod;b%=mod;ld res=a;res*=b;ll c=(ll)(res/mod);a*=b;a-=c*mod;a%=mod;if(a<0)a+=mod;return a;} ll mod_pow(ll a,ll b,ll mod){ll ans=1;while(b){if(b&1)ans=mul(ans,a,mod);a=mul(a,a,mod);b>>=1;}return ans;} ll div(ll x,ll y,ll mod){return mul(x,mod_pow(y,mod-2,mod),mod);} I main() { I h[26]; f(i,0,26)cin>>h[i]; S s; cin>>s; I mh=0; f(i,0,s.length()){ mh=max(mh,h[s[i]-97]); } cout<