import string

def designerPdfViewer(h, word):
    # Write your code here
    alphabet_list = list(string.ascii_lowercase)
    
    max_idx = -1
    for i in word:
        if max_idx < h[alphabet_list.index(i)]:
            max_idx = h[alphabet_list.index(i)]
            
    return max_idx * len(word)