Math is Fun

아직 제출이 없습니다시간 제한4초메모리 제한256 MB

문제

Boy XYZ introduced a simple math function called GLL\mathit{GLL} for an array of integers S=a_1,a_2,,a_nS = \\{a\_1, a\_2, \ldots, a\_n\\}:

GLL(S)=GCD(S) LCM(S)LCM(S).\mathit{GLL}(S) = \mathit{GCD}(S) \cdot   \mathit{LCM}(S) \cdot \mathit{LCM}(S)\text{.}

Here, GCD(S)=GCD(a_1,a_2,,a_n)\mathit{GCD}(S) = \mathit{GCD}(a\_1, a\_2, \ldots, a\_n) is the greatest common divisor of integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n, and LCM(S)=LCM(a_1,a_2,,a_n)\mathit{LCM}(S) = \mathit{LCM}(a\_1, a\_2, \ldots, a\_n) is the least common multiple of integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n.

For an array consisting of one element, GCD\mathit{GCD} and LCM\mathit{LCM} are equal to that element. For example, GCD\mathit{GCD} of S=xS = \\{x\\} is xx. Consider the LCM\mathit{LCM} and GCD\mathit{GCD} of an empty array as 00.

Now, XYZ is interested in finding the sum of GLL\mathit{GLL} values of all subarrays for a given array AA, but he finds the problem very hard. Help him calculate the following:

Answer=_SAGLL(S).\mathit{Answer} = \sum\_{S \subseteq A}\mathit{GLL}(S)\text{.}

Here, SAS \subseteq A means that SS is a subarray of AA, that is, the array AA with some (possibly zero, possibly all) elements removed.

As the answer can be very large, print it modulo 109+710^9 + 7.

입력

The first line of input contains TT, the number of test cases (1T501 \le T \le 50). TT test cases follow.

The first line of each test case contains NN, the number of elements in AA (1N1001 \le N \le 100). The next line contains NN space-separated positive integers: the elements of AA. The numbers in the array are in the range \[1,1000]\[1, 1000].

출력

For each test case, print the answer on a separate line.