Given an array of integers, determine the count of epic subarrays.
An array is called epic if its product is strictly increasing in each step of multiplying. Formally, we call a subarray a_l, a_{l+1}, \ldots, a_r to be strictly interesting at each step if and only if
The first line contains single integer (1 \le t \le 10^4) — the number of test cases.
The first line of each test case contains single integer (1 \le n \le 10^5) — the length of array .
The second line of each test case contains separated integers a_1, a_2, \ldots, a_n (1 \le a_1, a_2, \ldots, a_n \le 2) — the array .
It's guaranteed that \sum n \le 10^5 overall tests.
For each test case output single integer — the number of epic subarrays.
Please note! that the answer for some test cases won't fit into 32-bit integer type, so you should use at least 64-bit integer type in your programming language (like long long for C++).
Example
1
3
1 2 26Example 1
In the first test case, the epic subarrays are:
, , because the array is single element so it's trivially increasing.
is increasing because 1 < 1 \cdot 2.
is increasing because 2 < 2^2.
[1, 2, 2] is increasing because 1 < 2 < 2^2.
Thus the count is .
Subtask ( points): 1 \le \sum n \le 1000
Subtask ( points): a_1 = a_2 = \ldots = a_n
Subtask ( points): No additional constraints.