#include using namespace std; #define forn(i, n) for (int i = 0; i < n; i++) #define sz(a) (int)a.size() #define re return #define fi first #define se second #define mp(a, b) make_pair(a, b) typedef long long ll; typedef vector vi; typedef long double ld; typedef vector vll; typedef pair pii; typedef pair pll; int a[26]; string s; int main() { iostream::sync_with_stdio(0), cin.tie(0); //freopen("a.in", "r", stdin); //freopen(".out", "w", stdout); forn (i, 26) cin >> a[i]; cin >> s; int ma = 0; forn (i, sz(s)) ma = max(ma, a[s[i] - 'a']); cout << ma * sz(s); re 0; }