#include using namespace std; int h[30]; int main() { //ifstream cin ("Designer PDF Viewer.inp"); //ofstream cout ("Designer PDF Viewer.out"); ios_base::sync_with_stdio(false); cin.tie(NULL); for (int i = 1; i <= 26; i++) { cin >> h[i]; } string s; cin >> s; int maxHeight = 0; for (int i = 0; i < s.length(); i++) { maxHeight = max(maxHeight, h[s[i] - 'a' + 1]); } cout << maxHeight * s.length() << "\n"; }