using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { string[] h_temp = Console.ReadLine().Split(' '); int[] h = Array.ConvertAll(h_temp,Int32.Parse); string word = Console.ReadLine(); int len = word.Length; char[] cha = word.ToCharArray(); int max = 0; for (int i = 0; i < len ; i++) { int c = (int) cha[i] - 97; if (max < h[c]) max = h[c]; } int area = len*max; Console.WriteLine(area); } }