using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PDF { class Program { static void Main(string[] args) { string[] h_temp = Console.ReadLine().Split(' '); int[] h = Array.ConvertAll(h_temp, Int32.Parse); string word = Console.ReadLine(); var chars = word.ToCharArray(); var width = chars.Length; var height = chars.Select(x => h[(int)x - 97]).Max(); Console.WriteLine(width * height); } } }