We’re preparing your current view and syncing the latest data.
Given a word represented as a string of uppercase letters where each letter has a height, calculate the area of the rectangle highlighting the word. Each letter's width is 1 unit, and the height is the letter's given height. The total area is the length of the word multiplied by the maximum height among the letters in the word.
The first line contains 26 space-separated integers denoting the heights of each letter from 'a' to 'z'. The second line contains a single word consisting of lowercase English letters.
Print a single integer denoting the area of the rectangle highlighing the word.
Each height is at least 1 and at most 7. The word contains no more than 10 letters.
Example 1
Input
1 3 1 3 1 4 1 3 2 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 7 zaba
Output
28
Explanation
The letters 'z', 'a', 'b', 'a' have heights 7,1,3,1 respectively. Maximum height is 7, length is 4. Area = 7*4 = 28.