You are given an array $$$[a_1, a_2, \ldots, a_n]$$$. You wish to make the array empty by performing the following operation any number of times:
Determine the minimum total cost required to remove all the elements from the array $$$a$$$. Note that the total cost is equal to the sum of costs incurred over all the operations performed.
As the answer can be very large, report the answer modulo $$$676\,767\,677$$$.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 500$$$). The description of the test cases follows.
The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$.
The second line of each testcase contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 100$$$) — the elements of the array.
For each testcase, output a single integer — the minimum total cost required to make the array $$$a$$$ empty.
As the answer may be large, output the answer modulo $$$676\,767\,677$$$.
351 2 1 2 333 2 141 1 1 1
761
For the first testcase,
Thus, the total cost is equal to $$$4 + 3 = 7$$$. It can be shown that this is the minimum possible total cost.