Some problems are so classic that barely need a statement. For this one, please compute the minimum cost to insert letters into two words and to make them identical. Both words are made up of only letters chosen among the smallest lowercase letters (for instance, for , the alphabet is ). For every letter (call it ), inserting an in any place in any word has cost .
Input consists of several cases. Each case begins with , followed by strictly positive natural numbers $I_{\mbox{\texttt{a}}}, I_{\mbox{\texttt{b}}}, I_{\mbox{\texttt{c}}}, \ldots$. Follow two words and made up of between 1 and 1000 lowercase letters chosen among the smallest letters. Assume for every letter .
For every case, print the minimum cost to make and identical.
Input
2 11 10 aaa aba 4 100 100 100 1 abcd bcda 3 1 10 100 abbcabccabbac bbcabacabbac 4 1 2 1 4 dcbbcbbddccdabdbdbdcbbc cddcab
Output
21 200 102 40