|
||||||||||
Congruence equationTime Limit: 8000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 394 Accepted Submission(s): 111 Problem Description There is a sequence $A$ which contains $k$ integers. Now we define $f\left(m\right)$ is the number of different sequence $C$ that satisfies for $i$ from $1$ to $k$: 1. If $A_{i} = -1$, $C_{i}$ can be any integer in the range of $[0, m)$.Otherwise $C_{i} = A_{i} \pmod m$ 2. $\sum\limits_{i = 1} ^{k} C_{i}x_{i} \equiv 1 \pmod m$($x_{i}$ are variables) have a solution in the range of integer. Calculate the answer of $\sum\limits_{m = 1} ^{n} f(m) \pmod{10^9+7}$. Input The first line contains only one integer $T ( T \leq 100)$, which indicates the number of test cases. For each test case, the first line contains two integers $k$ and $n$.($1 \leq k \leq 50, 1 \leq n \leq 10^9$) The second line contains $k$ integers: $A_{1}, A_{2} \dots A_{k}(-1 \leq A_{i} \leq 10^9)$ There are at most $10$ test cases which satisfies $n \geq 10^6$ Output For each test case, output one line "Case #x: y", where x is the case number (starting from 1) and y is the answer after mod 1000000007 ($10^9+7$). Sample Input
Sample Output
Source | ||||||||||
|