You are given an array of positive integers .
A binary tree is special if all of these conditions are satisfied:
Two binary trees are different if one of these conditions is satisfied:
Note that the definition above is recursive.
For a given , you need to find the number of special binary trees whose number written on the root is not greater than
. Since the answer can be quite large, output it modulo
.
The first line contains a single integer
(
) --- the number of test cases. Then
test cases follow.
The first line of each test case contains two integers
(
).
The second line of each test case contains
integers
(
).
For each test case, print a single integer: the number of special binary trees whose number written on the root is not greater than. Remember that you only need to print it modulo
.