Selim is a computer science student who has trouble doing character and integer conversions. Thereupon, Selim's programming teacher, Serhat, prepares a challenging but instructive assignment for him.
In the assignment, Serhat gives a word
For example, for the word 'acb', the 'ab' combination equals 1+2 = 3, and the 'acb' combination equals 1+3+2 = 6. Remember that the number values of the letters are given with respect to their order in the alphabet.
However, Selim claims that these letter combinations may be too long and that he cannot calculate them all as quickly as requested. Convinced by these reasons, Serhat puts a limit on the length of combinations to be considered as
Selim really wants to ace this assignment but doesn't know how. You are expected to assist him.
The first line contains a string
The following line contains the target sum
$1 \leq length\ of\ w \leq 20 $ $1 \leq t \leq 520$ $1 \leq k_{max} \leq 20$
For each
serhat 24 6
0 1 1 0 0 0
For two letters 'e' and 's', for three letters 'a', 'e' and 'r' satisfies the conditions.