#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(){ ios_base::sync_with_stdio(false); 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 height = 1; for(char ch: word) { height = max(height, h[ch - 'a']); } int width = word.length(); cout << width * height; return 0; }