Chino has some special preferences toward string.
Now Chino has a string set with

strings. She marks each string in the set with specific scores indicated the level of her favor. The special preferences of Chino toward string is when a string with positive score she will like it and with negative score she disgust.
Chino wants to build a new string with

characters, then she want to score this string. The score of new string is calculated by the strings in the set is equal to the sum of each of them occurrences times in new string multiplied respective scores.
Now there is a sample case. In the set there is only contain one string

and scored

points. The new string is

. Then the string

occurs two times in the new string , so the new string should be scored

points.
Now Chino wants to know the maximal score of new string she built.