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(); var mh = 0; foreach (var c in word) { mh = Math.Max(mh, h[c - 'a'] ); } Console.WriteLine(mh * word.Length); } }