|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||3||3||3||100.000%|
Cafe Satori hires only experienced waiters, and there is a reason for that. Everyday during lunchtime, at 12:00 noon, a horde of hungry customers enters the cafe and waits to be served. Therefore, the only waiter on duty has his hands full. Fortunately, his heroic work will be rewarded with generous tips.
Each customer is willing to leave a specific amount of tip, provided he is served immediately. For each minute of waiting the tip decreases by one, until it reaches zero.
It takes one minute for the waiter to serve a customer. Solve the waiter's problem and calculate how much money he can get, provided he serves customers in an optimal order.
The first line of input contains the number of test cases $z$ ($1 \leq z \leq 10^9$). The descriptions of the test cases follow.
The first line of each test case contains the number of customers $n$ ($1 \le n \le 100\,000$). The second line contains $n$ non-negative integers not exceeding $10^9$: these are the amounts of tips the customers are willing to give initially.
The total number of customers in all test cases does not exceed $1\,000\,000$.
For each test case, output the maximum total amount of tips the waiter can get.
1 6 0 9 9 1 7 5