object Solution { def main(args: Array[String]) { val sc = new java.util.Scanner (System.in); var h = new Array[Int](26); for(h_i <- 0 to 25) { h(h_i) = sc.nextInt(); } var word = sc.next(); val charHeights: Map[Char,Int] = ('a' to 'z').zip( h ).toMap val maxHeight = word.toLowerCase().toList.map{ c => charHeights(c) }.max println( maxHeight * word.length ) } }