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 max = 1; for(int i = 0; i < word.Length; ++i) { max = Math.Max(h[word[i]- 'a'], max); } Console.WriteLine(max * word.Length); } }