You are given around five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score.
For example, when the list in sample is sorted into alphabetical order, PAMELA, which is worth , is the name in the list. So, PAMELA would obtain a score of .
You are given queries, each query is a name, you have to print the score.
The first line contains an integer , i.e., number of names.
Next lines will contain a Name.
Followed by integer followed by lines each having a word.