The chiefs of the famous Mumba-Yumba tribe decided to devise a new battle cry for their warriors. They specified that the cry must consist of exactly letters (the tribe's alphabet contains letters). After much research, they found that if the cry contains a word s_i (a sequence of up to three letters from the alphabet), then this cry induces f_i units of fear in the enemy. If the cry contains several such words, their "fearfulness" is summed. For example, if the cry contains the words s_i and s_j, then the cry induces f_i + f_j units of fear.
The first line contains three integers: , , and (0 < N \leq 100, 0 < M < 25, 0 \leq K \leq 100), where is the number of fearsome words. The next line contains the alphabet—a string of lowercase Latin letters. The following lines each describe a word: the word itself and, separated by a space, a single integer indicating its fearfulness (0 < f_i \leq 10000).
Print the fearfulness of the resulting cry.
Example 1