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 m = 0; foreach(byte b in new System.Text.ASCIIEncoding().GetBytes(word)) { if (h[b - 97] > m) m = h[b - 97]; } Console.WriteLine(m * word.Length); } }