Moortal Kombat#10292

Moortal Kombat

1 second
128 megabytes
Hard

Bessie has been playing the popular game Moortal Kombat for a long time. However, the game developers have recently released an update that forces her to change her usual play style.

The game uses buttons, labeled with the first lowercase letters of the Latin alphabet. Bessie's favorite combination of moves is a string of length , describing a sequence of button presses. After the update, each combo must consist of a sequence of "stripes", where a stripe is defined as a consecutive sequence of the same button pressed at least times in a row. Bessie wants to modify her favorite combination to obtain a new string of the same length , but consisting of stripes that satisfy the updated rules.

It is known that Bessie needs a_{ij} days to learn to press button instead of button in any specific position of her combination (that is, replacing one occurrence of letter in with letter costs a_{ij} days).

Note that sometimes the replacement can be done faster through intermediate buttons. For example, changing directly to may be more expensive than performing two consecutive replacements i \rightarrow k \rightarrow j. Thus, there may exist a transformation path from to with a smaller total cost than the direct replacement.

Help Bessie determine the minimum number of days required to create a combination that satisfies the new requirements.

Input

The first line contains three integers: (1 \le n \le 10^5), (1 \le m \le 26), and (1 \le k \le n).

The second line contains the string .

The next lines each contain integers — the elements of the matrix a_{ij}, where a_{ij} is the number of days required to replace button with button . It is guaranteed that 0 \le a_{ij} \le 1000 and a_{ii} = 0 for all .

Output

Print the minimum number of days Bessie needs to create a combination that meets the new requirements.

Examples

Example

Input
5 5 2
abdec
0 1 2 3 4
1 0 1 4 2
4 3 0 4 1
1 2 1 0 4
3 1 4 2 0
Output
5

Example 1

Loading
Loading

Note

In this example, the optimal solution is to replace with , then replace with , and finally replace both 's with . The total cost of these changes is 1 + 4 + 0 + 0 = 5 days, and the resulting string will be .