#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
#define read() freopen("in.txt","r",stdin)
#define write() freopen("out.txt","w", stdout)
#define arrsize (ll)1e6+1
#define vul()  prllf("-1\n");
#define out() cout<<ans<<endl;
#define loop(i,n) for( ll i =0; i<n; i++)
#define loopn(i,n) for( ll i=1; i<=n; i++)
#define debug1(x) cout<<x<<endl;
#define debug2(x,y) cout<<x<<ends<<y<<endl;
#define debug3(x,y,z) cout<<x<<ends<<y<<ends<<z<<endl;
#define sdi(x) cin>>x;
#define sdii(x,y) cin>>x>>y;
#define YES cout<<"YES\n";
#define NO cout<<"NO\n";
#define newline cout<<endl
#define MEM(arr, value) memset( arr, value , sizeof arr)

ll Set( ll n, ll pos)
{
    return ( n=n | 1<<pos );
}
ll reset(ll N,ll pos)
{
    return N= N & ~(1<<pos);
}
bool check(ll N,ll pos)
{
    return (bool)(N & (1<<pos));
}
ll pow(ll a, ll b, ll mod)
{
    ll x = 1, y = a;
    while(b > 0)
    {
        if(b%2 == 1)
        {
            x=(x*y);
            if(x>mod) x%=mod;
        }
        y = (y*y);
        if(y>mod) y%=mod;
        b /= 2;
    }
    return x;
}

ll modInverse(ll a, ll m)
{
    return pow(a,m-2,m);
}

typedef unsigned long long ull;

///     /////////////////////////////////

#define sc(x) scanf("%d",&x)

#define scl(x) scanf("%I64d",&x)

#define output freopen("out.txt" , "w", stdout)
typedef pair<ll, ll>  pll;

#define mp make_pair

#define pb push_back

int main ()
{

#ifndef ONLINE_JUDGE
//    read();
//    write();
#else
// online submission
#endif
int arr[100];
for ( int i =0; i<26; i++)
    cin>>arr[i];
    int maxi =0, tot =0;
    string in;
    cin>>in;
    for( int i =0; i<in.size() ;i++)
    {
        tot++;
        maxi = max( maxi, arr[in[i]-'a']);
    }

    cout<<maxi*tot<<endl;


}