Limits 1s, 512 MB

Pudding is playing a game that has nn levels. There are a total of n(n+1)/2n(n+1)/2 coins spread out among the levels. Specifically, iith level has pip_i coins where p1,p2,,pnp_1, p_2, \cdots, p_n form a permutation of 1,2,,n1, 2, \cdots, n. Pudding wants to pick all the coins in each level. However, her game character can only carry BB coins in a level where BB is the capacity of her bag. In level 11, B=1B=1 and after completing each level, she stores the collected coins in a bank. Thus, the bag is emptied after each level and the capacity BB increases by 11. So if n=4n=4 and the pip_i are 2,1,4,32, 1, 4, 3, she will be able to take 1+1+3+3=81+1+3+3=8 coins from the game.

Pudding knows that the game has nn levels. However, she doesn't know the permutation p1,p2,,pnp_1, p_2, \cdots, p_n. She has many queries in mind. A query of qiq_i asks how many permutations p1,,pnp_1,\cdots, p_n are there such that she will pick exactly qiq_i coins after finishing the whole game. Note that in each level, she picks as many coins as she possibly can.

Help her answer these queries. But since the counts are huge, you have to output it modulo 10000000001000000000.

Input

The first line of input will contain a positive integer nn (1n1001 \leq n \leq 100). The next line will contain a positive integer tt (1t1001 \leq t \leq 100), the number of queries. Each of the next tt lines will contain a positive integer qiq_i (1qi100001 \leq q_i \leq 10000), the number of coins she will pick.

Output

Output tt lines. The ii-th line will contain the answer to ii-th query.

Sample

InputOutput
3
3
6
4
10
1
3
0

Submit

Login to submit.

Statistics

73% Solution Ratio
NirjhorEarliest, Apr '22
serotoninFastest, 0.0s
adnan_tokyLightest, 8.4 MB
serotoninShortest, 659B
Toph uses cookies. By continuing you agree to our Cookie Policy.