#!/bin/python import sys letras = "abcdefghijklmnopqrstuvwxyz" h = map(int,raw_input().strip().split(' ')) word = raw_input().strip() max = 0 for w in word: if(h[letras.index(w)]>max): max = h[letras.index(w)] print(len(word)*max)