String potential
You are given a string s containing k first lower-case letters of Latin alphabet. As in the problem, we define a distance between two symbols s_i, s_j of this string as difference between their positions, i.e. |j-i|. Let us define the potential of string in the following way. Let the function f(c_1, c_2) which for each pair of letters gives some weight is known. This function is symmetric with respect to arguments, i.e. f(c_1, c_2) = f(c_2, c_1). The potential between the pair of symbols s_i, s_j will be defined as a product of a pair weight and a distance between of its symbols. The string potential will be calculated by summing up of potential of all pairs of symbols.
Write the program that calculates the potential of given string s.
Input
The first line of the input file contains integer k (1 ≤ k ≤ 26), the number of first Latin letters allowing in string. The second line contains a string s. Its length does not exceed 10^6. In following k lines the weight function is given. i-th line consists of i numbers, j-th number in i-th line defines the weight for i-th and j-th Latin letters. All weights do not exceed 10^6 by absolute value.
Output
Output one number – the potential of a string s.