#!/bin/python import sys heights = map(int,raw_input().strip().split(' ')) word = raw_input().strip() big = 0 for i in word : if heights[ord(i)%97] > big : big = heights[ord(i)%97] print len(word) * big