Seunghyun builds sequences a1,a2,…,aN of length N for customers who need one. He is early in his career, so he can only build sequences whose elements are integers between −2 and 2, and few customers come to him.
Jihak ordered a sequence from him. From the finished sequence Jihak picks one contiguous block ai,ai+1,…,aj−1,aj (1≤i≤j≤N) and wants the product of its elements, ai×ai+1×⋯×aj−1×aj, to be as large as possible. If i=j, the product is ai.
Given the sequence Seunghyun built, find the largest product Jihak can obtain.
The first line contains the number of test cases T (1≤T≤100000). The T test cases follow.
The first line of each test case contains the length of the sequence N (2≤N≤100000). The second line contains the elements a1,a2,…,aN (−2≤ai≤2), separated by spaces.
The sum of N over all test cases does not exceed 300000.
For each test case, print the largest product modulo 1,000,000,007 (=109+7) on its own line.
Compare the true products when choosing the largest one, then reduce only that chosen value modulo 109+7.