#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include 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 maxheight = INT_MIN; for(auto c : word) maxheight = max(maxheight, h[c - 'a']); cout << maxheight * word.size() << endl; return 0; }