//It’s never too late to become what you might have been....
 #include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf 1000000000000
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define S second
#define F first
#define boost1 ios::sync_with_stdio(false);
#define boost2 cin.tie(0);
#define mem(a,val) memset(a,val,sizeof a)
#define endl "\n"
#define maxn 100001
ll h[maxn];
int main()
{
	boost1;boost2;	
	ll i,j,maxi=0;
	string s;
	for(i=0;i<26;i++)
		cin>>h[i];
	cin>>s;
	for(i=0;i<s.length();i++)
		maxi=max(maxi,h[s[i]-'a']);
	cout<<maxi*s.length();
	return 0;
}