#include #include #include #include #include using namespace std; int h[26]; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ for (int i = 0; i < 26; ++i) { cin >> h[i]; } string s; cin >> s; int mh = 0; for (char q: s) { mh = max(mh, h[q - 'a']); } cout << s.size() * mh << endl; return 0; }