For an array of positive integers, its shadow array of length is defined as follows:
You are given the shadow array . Your task is to find the number of valid original arrays consisting of positive integers that could have produced .
Since this number can be very large, output it modulo 10^9 + 7.
The first line contains a single integer (1 \le t \le 10^4) — the number of test cases.
The first line of each test case contains a single integer (1 \le n \le 10^6) — the length of the array.
The second line of each test case contains integers h_1, h_2, \dots, h_n (1 \le h_i \le 10^9) — the elements of the shadow array .
It is guaranteed that the sum of over all test cases does not exceed 10^6.
For each test case, output a single integer — the number of valid original arrays modulo 10^9 + 7.
Example 1
In the first test case, h = [2, 2, 2]. There are exactly valid original arrays that produce this shadow array:
a = [2, 1, 2]
a = [2, 2, 2]
Subtask ( points): \sum n \le 8 and h_i \le 8.
Subtask ( points): \sum n \le 1000 and h_i \le 100.
Subtask ( points): No additional constraints.