#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define loop(i, x) for (int i = 0; i < x; i++) using namespace std; int main(){ int n = 26; vector h(n); for(int h_i = 0;h_i < n;h_i++){ cin >> h[h_i]; } string word; cin >> word; int length = word.length(); int max_h = h[word[0]-'a']; loop(i,length) if (h[word[i]-'a'] > max_h) max_h = h[word[i]-'a']; cout << max_h*length; return 0; }