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 width = word.Length; int height = 0; foreach(char c in word) { int offset = c - 'a'; int thisHeight = h[offset]; if (thisHeight > height) height = thisHeight; } Console.WriteLine(width * height); } }