#EXLAGFIB. Extremely Lagged Fibonacci

Extremely Lagged Fibonacci

Let $(\ a_i\ )_{i=0}^\infty$ be the integer sequence such that: $$a_n = \begin{cases} 0 & (0 \le n < k - 1) \\ 1 & (n = k - 1)\\ b \cdot a_{n-j} + c \cdot a_{n-k} & (n \ge k) \end{cases}, $$ where $j$, $k$, $b$ and $c$ is integer.

For each $n, j, k, b$ and $c$, find $a_n$ modulo $1\,000\,000\,037$.

Input

The first line contains $T$, the number of test cases.

Each of the next $T$ lines contains five integers $n, j, k, b$ and $c$.

Output

For each test case, print $a_n$ modulo $1\,000\,000\,037$.

Constraints

  • $1 \le T \le 10^2$
  • $0 \le n \le 10^9$
  • $10^5 \le k \le 10^8$, $1 \le j < k$
  • $1 \le b \le 10^9$, $1 \le c \le 10^9$

Example

Input:
2
1000000 1 100000 1 1
1000000000 1 100000000 1 1

Output: 372786243 994974348

</p>