a = list(map(int,input().split())) s = input() letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] m = 0 for i in range(len(letters)): if letters[i] in s: m = max(m,a[i]) print(len(s)*m)