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 = '# your code goes here.............\n# Python 3 program to find sun of \n# numbers formed by all permutations \n# of given set of digits \n\n# function to calculate factorial \n# of a number \ndef factorial(n): \n\n\tf = 1\n\tif (n == 0 or n == 1): \n\t\treturn 1\n\tfor i in range(2, n + 1): \n\t\tf = f * i \n\treturn f \n\n# Function to calculate sum \n# of all numbers \ndef getSum(arr, n): \n\n\t# calculate factorial \n\tfact = factorial(n) \n\n\t# sum of all the given digits at \n\t# different positions is same and \n\t# is going to be stored in digitsum. \n\tdigitsum = 0\n\tfor i in range(n): \n\t\tdigitsum += arr[i] \n\tdigitsum *= (fact // n) \n\n\t# Compute result (sum of \n\t# all the numbers) \n\tres = 0\n\ti = 1\n\tk = 1\n\twhile i <= n : \n\t\tres += (k * digitsum) \n\t\tk = k * 10\n\t\ti += 1\n\n\treturn res \n\n# Driver Code \ndef __starting_point(): \n\t\n\t# n distinct digits\n\tt=int(input())\n\tfor _ in range(t):\n\t    m=int(input())\n\t    arr = list(map(int,input().split())) \n\t    n = len(arr) \n\n\t# Print sum of all the numbers formed \n\t    print(getSum(arr, n)) \n\n# This code is contributed by ita_c \n\n\n\n\n\n\n__starting_point()'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13791