/* Do not go gentle into that good night, Old age should burn and rave at close of day; Rage, rage against the dying of the light. Though wise men at their end know dark is right, Because their words had forked no lightning they Do not go gentle into that good night. Good men, the last wave by, crying how bright Their frail deeds might have danced in a green bay, Rage, rage against the dying of the light. Wild men who caught and sang the sun in flight, And learn, too late, they grieved it on its way, Do not go gentle into that good night. Grave men, near death, who see with blinding sight Blind eyes could blaze like meteors and be gay, Rage, rage against the dying of the light. -Dylan Thomas */ #include #include #include #include #include #include #include #include #include #include #include using namespace std ; #define LL long long #define si(X) scanf("%d",&X) #define sl(X) scanf("%lld",&X) #define pi(X) printf("%d ",X) #define pl(X) printf("%lld ",X) #define pin(X) printf("%d\n",X) #define pln(X) printf("%lld\n",X) #define pb push_back #define mp make_pair #define rep(i,n) for(int i = 0 ; i < n ; i++) #define repL(i,a,b) for(int i = a ; i <= b ; i++) #define INF 1ll<<60 #define IMAX 1e9+7 #define MAX 100005 int arr[30] ; int main() { for(int i = 0 ; i < 26 ; i++) si(arr[i]) ; string pok ; cin >> pok ; int l = pok.length(); int max_val = 0 ; rep(i,l) { max_val = max(max_val , arr[pok[i] - 'a']) ; } int answer = max_val * l ; pin(answer) ; return 0 ; }