We define a function F, on a array , P ,as follows:
where:
Ma5termind loves creating new challenges and he need your help testing his newest one. Given a array A consisting of N elements, compute the maximum value of F over all possible subarrays of A.
As result can be quite large, print it modulo 109+7.
Each input file will contain a T test cases.
First line will contain a single integer N denoting number of elements in array A.
Next line will contain a list of N integers Ai.
For each test case, output the answer in new line.
The maximum value of is for sub-array {1,2}.