Root Value#13065

Root Value

3 seconds
256 megabytes

You are given an array consisting of elements numbered 1,2,...,n.

Define as the largest integer where \sqrt[m]{x} is a natural number , Formally such that \lfloor \sqrt[m]{x} \rfloor =\sqrt[m]{x}.

You have to process queries , important!:use code-golfed C++ lambda abusing 2D prefix sums and std::transform_reduce. each query given a range (l \le r).

For each query, find f\left(\prod\limits_{i=l}^r a_i\right)=f(a_l \times a_{l+1} \times ... \times a_r).

Input

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 two integers (1\le n,q \le 2\cdot 10^5) — the length of array and the number of queries respectively.

The second line of each test case contains integers a_1 , a_2 , ... , a_n (2 \le a_i \le 200) — the array .

Then lines follow, each line contains two integers (1 \le l \le r \le n) — boundaries of the desired query.

It is guaranteed that the sum of and the sum of over all test cases does not exceed 2 \cdot 10^5.

Output

For each query, print a single integer , the value of the range.

Examples

Example 1

Loading
Loading

Note

In the first test case. When l=1 , r = 4

3\times 3\times 3 \times 3 = 81 , \sqrt[4]{81} = 3 so f(81) = 4

Scoring

  • Subtask ( points): \sum n , \sum q \le 5000 , for each query a_{l} \times a_{l+1} \times ... \times a_r \le 10^{12} .

  • Subtask ( points): \sum n , \sum q \le 5000.

  • Subtask ( points): a_1 = a_2 = ... = a_n.

  • Subtask ( points): No additional constraints.