/* * ===================================================================================== * * Filename: a.cpp * * Description: * * Version: 1.0 * Created: Tuesday 23 August 2016 09:56:30 IST * Revision: none * Compiler: gcc * * Author: Shounak Dey (), dylandey1996@gmail.com * Organization: * * ===================================================================================== */ #include using namespace std; typedef long long int ll; int main() { ll h[26]; for(ll i=0;i<26;i++) cin >> h[i]; ll H=0; string s; cin >> s; for(ll i=0;i < s.length();i++) H = max(H,h[s[i]-'a']); //cout << H << endl; cout << H * s.length() << endl; return 0; }