See Problem N for PDF statements.
The first line contains a single integer(
), indicating that a good string consists of decimal digits less than
.
The second line containsintegers
(
,
), indicating that the decimal digit
appears at least
times in a good string.
The third line contains a single integer(
), indicating the number of queries.
Each of the nextlines contains a single integer
(
), indicating the length of the string.
For each query, output an integer in a single line indicating the number of different good strings of length. As the answer may be large, please output the answer modulo
.