Sereja and Array and Subtracting

All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.
Sereja has an array A of N positive integers : A[1], A[2], A[3], ... , A[N].
In a single operation on the array, he performs the following two steps :
 Pick two indices i, j s.t. A[i] > A[j]
 A[i] = A[j]
Sereja can apply these operations any number of times (possibly zero), such that the sum of resulting elements of the array is as small as possible.
Help Sereja find this minimum sum.
Input
First line of input contains an integer T  the number of test cases. T test cases follow.
First line of each test case contains the integer N. The next line contains N integers — A[1], A[2], A[3], ... , A[N].
Output
For each test case, output a single line with the answer.Constraints
 1 ≤ T ≤ 10
 1 ≤ N ≤ 10^{5}
 1 ≤ A[i] ≤ 10^{9}
Example
Input: 2 1 1 3 2 4 6 Output: 1 6
Explanation
Example case 2. In this case, one possible way in which Sereja can perform the operations could be as follows.
 Pick i = 2, j = 1. A[2] = A[1]. Now the resulting array would be [2, 2, 6].
 Pick i = 3, j = 2. A[3] = A[2]. Now the resulting array would be [2, 2, 4].
 Pick i = 3, j = 2. A[3] = A[2]. Now the resulting array would be [2, 2, 2].
Author:  sereja 
Tester:  iscsi 
Editorial  http://discuss.codechef.com/problems/SEAARASU 
Tags  cook64, easy, gcd, mathematics, numbertheory, sereja 
Date Added:  6112015 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 