Today RK has to transport his N items of different weights(in calories) to a near city but before that he wants to make sure that the weights of all items are balanced. In order to check this he puts all items on the weight scale and found that weights are not balanced actually. So to deal with it RK designed his own procedure.
RK chooses two different weights say A and B such that weight(A) > weight(B) and reduce the weight of A by weight(B) calories. He repeats this procedure as many times as he needed. The ultimate goal of RK is to balance all weights by minimizing the sum of all weights using his own procedure. RK has asked for your help as their are large number of items. So make a quick move and help RK .

INPUT :

The first line contains the number of test cases T(1 ≤ T ≤ 10). First line of each test case contains a positive integer N(2 ≤ N ≤ 10^6)-Number of items .Second line contains N space separated positive integers in the interval [1,10^9] representing weight of each item in calories.

OUTPUT :

For each test case output the minimum sum of all balanced weights.

SAMPLE INPUT
2
3
3 6 9
2
2 2

SAMPLE OUTPUT
9
4
from fractions import gcd
cases = input()
while cases > 0:
	c = input()
	a = map(int, raw_input().split())
	b = a[0]
	a.remove(b)
	for i in a:
		b = gcd(b,i)

	print b * c
	cases -= 1