#include using namespace std; #define MOD 1000000007 #define pb push_back #define mp make_pair #define all(c) (c).begin(),(c).end() #define sz(a) int((a).size()) #define F first #define S second #define rep(i, a, b) for(int i = a; i < b; ++i) typedef long long ll; typedef long double ld; typedef vector vi; typedef pair pii; typedef pair piii; typedef vector vpii; typedef vector vpiii; inline ll powmod(ll x, ll n, ll _mod){ ll res = 1; while (n){ if (n & 1)res = (res*x) % _mod; x = (x*x) % _mod; n >>= 1; } return res; } #define N 100005 int a[27]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); //freopen("a.txt","r",stdin); //freopen("o.txt","w",stdout); int mx=0; rep(i,0,26){ cin>>a[i]; } string s; cin>>s; rep(i,0,sz(s)){ mx=max(mx,a[s[i]-'a']); } int ans=(int)s.size()*mx; cout<