Math is Fun
시간 제한4초메모리 제한256 MB
배열 A의 모든 연속 부분배열 S에 대해 GCD(S) * LCM(S)^2의 합을 10^9+7로 나눈 나머지를 구합니다. N은 100 이하, 각 값은 1000 이하입니다.
문제
Boy XYZ introduced a simple math function called for an array of integers :
Here, is the greatest common divisor of integers , and is the least common multiple of integers .
For an array consisting of one element, and are equal to that element. For example, of is . Consider the and of an empty array as .
Now, XYZ is interested in finding the sum of values of all subarrays for a given array , but he finds the problem very hard. Help him calculate the following:
Here, means that is a subarray of , that is, the array with some (possibly zero, possibly all) elements removed.
As the answer can be very large, print it modulo .
입력
The first line of input contains , the number of test cases (). test cases follow.
The first line of each test case contains , the number of elements in (). The next line contains space-separated positive integers: the elements of . The numbers in the array are in the range .
출력
For each test case, print the answer on a separate line.