During Quarantine Time Chef is at home and he was quite confused about what to cook so, he went to his son and asked about what would he prefer to have? He replied, cakes.
Now, chef cook $N$ number of cake and number of layers for every cake is different. After cakes are baked, Chef arranged them in a particular order and then generates a number by putting number of layers of cakes as digit in sequence (e.g., if chef arranges cakes with layers in sequence $2$, $3$ and $5$ then generated number is $235$).
Chef has to make his son powerful in mathematics, so he called his son and ask him to arrange the cakes in all the possible ways and every time when different sequence is generated he has to note down the number. At the end he has to find sum of all the generated numbers. So, help him to complete this task.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- The first line of each test case contains a single integer $N$ denoting number of cakes.
- The second line contains $N$ space-separated integers $L1$ $L2$ … $LN$ layers of the cake.

-----Output:-----
For each test case, print a single line containing sum of all the possible numbers which is generated by arranging cake in different sequence.

-----Constraints :-----
- $1 \leq T  \leq 2*10^5$
- $1 \leq N, L1, L2, L3,…, LN \leq 9$

-----Sample Input:-----
1
3
2 3 5

-----Sample Output:-----
2220

-----Explanation:-----
Sum of all possibilities :
$235 + 532 + 253 + 352 + 523 + 325 = 2220 $

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "# def toString(List): \r\n# \treturn ''.join(List) \r\n \r\n# def permute(a, l, r): \r\n# \tif(l==r): \r\n# \t\tlist_ = []\r\n# \t\tlist_.append(toString(a))\r\n# \t\treturn list_'''\r\n# \t\tprint(toString(a))\t\t\r\n# \telse: \r\n# \t\tfor i in range(l,r+1): \r\n# \t\t\ta[l], a[i] = a[i], a[l] \r\n# \t\t\tpermute(a, l+1, r) \r\n# \t\t\ta[l], a[i] = a[i], a[l]\r\n\r\n# for _ in range(int(input())):\r\n# \tn = int(input())\r\n# \tp = list(map(str , input().split())) \r\n# \tpermute(p, 0, n-1)\r\n'''def permutation(start, end):\r\n    if(end == start):\r\n        #return a\r\n        print(*a)\r\n    for i in range(start, end+1):\r\n        a[i],a[start] = a[start],a[i]\r\n        permutation(start+1, end)\r\n        a[i],a[start] = a[start],a[i]\r\nfor _ in range(int(input())):\r\n\tn = int(input())\r\n\ta = list(map(int,input().split()))\r\n\tpermutation(0,len(a)-1)'''\r\n\t\r\ndef factorial(n): \r\n\r\n\tf = 1\r\n\tif(n == 0 or n == 1): \r\n\t\treturn 1\r\n\tfor i in range(2, n + 1): \r\n\t\tf = f * i \r\n\treturn f \r\n \r\ndef getSum(arr, n): \r\n \r\n\tfact = factorial(n) \r\n\tdigitsum = 0\r\n\tfor i in range(n): \r\n\t\tdigitsum += arr[i] \r\n\tdigitsum *= (fact // n) \r\n\tres = 0\r\n\ti = 1\r\n\tk = 1\r\n\twhile(i <= n): \r\n\t\tres += (k * digitsum) \r\n\t\tk = k * 10\r\n\t\ti += 1\r\n\r\n\treturn res \r\n \r\nfor _ in range(int(input())):\r\n\tn = int(input())\r\n\tarr = list(map(int , input().split()))\r\n\tprint(getSum(arr, n)) "
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13295