题目描述
Background
The annual Christmas is approaching. Every year, Little E receives many gifts, and he also gives out many gifts. Different people have different importance in Little E's heart, and those who are more important receive more gifts.
Problem Description
Little E has purchased $n$ gifts from the store, intending to give them to $m$ people, where the number of gifts for the $i$-th person is $w_i$. Please help calculate the number of ways to distribute the gifts (two schemes are considered different if and only if someone receives different gifts in the two schemes). Since the number of schemes may be very large, you only need to output the result modulo $P$.
Input Format
The first line contains an integer $P$, representing the modulus.
The second line contains two integers $n$ and $m$, representing the number of gifts Little E bought and the number of people receiving gifts, respectively.
From the 3rd to the $(m + 2)$-th line, each line contains an integer, where the $(i + 2)$-th line's integer $w_i$ represents the number of gifts for the $i$-th person.
Output Format
If there is no feasible scheme, output Impossible; otherwise, output an integer representing the number of schemes modulo $P$.
Sample Input and Output
Sample Input #1
100
4 2
1
2
Sample Output #1
12
Sample Input #2
100
2 2
1
2
Sample Output #2
Impossible
Notes
Sample 1 Explanation
The gifts for the first and second persons are separated by /. The 12 schemes are detailed as follows:
1/23 1/24 1/34
2/13 2/14 2/34
3/12 3/14 3/24
4/12 4/13 4/23
Data Size and Constraints
Let $P = \prod_{i=1}^t p_i^{c_i}$, where $p_i$ are prime numbers.
For 15% of the data, $n \leq 15$, $m \leq 5$, $p_i^{c_i} \leq 10^5$.
For the remaining 85% of the data, about 60% of the data satisfy $t \leq 2$, $c_i = 1$, $p_i \leq 10^5$, and about 30% of the data satisfy $p_i \leq 200$.
For 100% of the data, $1 \leq n \leq 10^9$, $1 \leq m \leq 5$, $1 \leq p_i^{c_i} \leq 10^5$, $1 \leq w_i \leq P \leq 10^9$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分