#nt604. 礼物
礼物
Gifts
Problem Source
National Team Internal Test 11
Problem Description
Christmas is approaching again. Every year little E receives many gifts and also gives many away. Different people matter differently to little E, and the more important someone is, the more gifts they receive.
Little E bought gifts from a shop to give to people, and the -th person is to receive gifts. Please help compute the number of ways to distribute the gifts (two distributions are considered different if and only if at least one person receives a different set of gifts). Since the number of ways may be huge, you only need to output the result modulo .
Input Format
The first line contains a positive integer , the modulus. The second line contains two integers and , representing the number of gifts little E bought and the number of recipients.
The following lines each contain a single positive integer , the number of gifts for the -th person.
Output Format
If no valid distribution exists, output Impossible; otherwise output one integer: the number of ways modulo .
Sample Input
100
4 2
1
2
Sample Output
12
Constraints
Let $P = p_1^{c_1} \times p_2^{c_2} \times p_3^{c_3} \times \dots \times p_t^{c_t}$, where each is prime.
For of the data: , , .