# your code goes here x = raw_input() x = x.split(' ') x = map(int,x) y = raw_input() y = list(y) max = 0 for i in y: temp = ord(i)-97 if x[temp]>max: max = x[temp] print len(y)*max