There are now 26 types of cards, the cards face are $a$ to $z$, the weight of the set a is $1$, and the weight of the $z$ is $26$. Bob now has $n$ cards, and in order to defeat the evil Dark Magician, he needs to unleash a powerful magic spell of $m$ times. However, he can go to the store and exchange cards for cards, and the rule of exchanging cards is that each card can be exchanged with multiple other cards with the same sum of weights. And the cost is the difference between this card and the minimum weight of the exchanged cards. He wondered if he could defeat the evil Dark Magician and, if so, what was the minimum cost he would need to have $m$ cards.
3
3 5
abc
4 14
cdeg
3 100
zzz
2
10
-1