#include using namespace std; typedef long long LL; #define PII pair #define all(c) c.begin(),c.end() #define sz(c) (int)c.size() #define clr(c) c.clear() #define pb push_back #define mp make_pair #define cin(x) scanf("%d",&x) #define MOD 1000000007 #define EPS 1E-10 int main() { int abc[30] = {0}; for(int i = 0; i < 26; i++) cin >> abc[i]; string s; cin >> s; int maxH = 0; LL wid = sz(s); for(int i = 0; i < sz(s); i++) maxH = max(maxH, abc[s[i] - 'a']); cout << maxH * wid << "\n"; return 0; }