Time Limit: 6000/3000 MS (Java/Others)

Memory Limit: 262144/262144 K (Java/Others)

CA is a fine comrade who loves the party and people; inevitably she loves GCD (greatest common divisor) too.

Now, there are $N$ different numbers. Each time, CA will select several numbers (at least one), and find the GCD of these numbers. In order to have fun, CA will try every selection. After that, she wants to know the sum of all GCDs.

If and only if there is a number exists in a selection, but does not exist in another one, we think these two selections are different from each other.

Now, there are $N$ different numbers. Each time, CA will select several numbers (at least one), and find the GCD of these numbers. In order to have fun, CA will try every selection. After that, she wants to know the sum of all GCDs.

If and only if there is a number exists in a selection, but does not exist in another one, we think these two selections are different from each other.

First line contains $T$ denoting the number of testcases.

$T$ testcases follow. Each testcase contains a integer in the first time, denoting $N$, the number of the numbers CA have. The second line is $N$ numbers.

We guarantee that all numbers in the test are in the range [1,1000].

$1 \le T \le 50$

$T$ testcases follow. Each testcase contains a integer in the first time, denoting $N$, the number of the numbers CA have. The second line is $N$ numbers.

We guarantee that all numbers in the test are in the range [1,1000].

$1 \le T \le 50$

提交代码