#C11597. Sum of Unique Elements

    ID: 40930 Type: Default 1000ms 256MiB

Sum of Unique Elements

Sum of Unique Elements

You are given several test cases. For each test case, you are given a list of positive integers. Your task is to compute the sum of unique elements in each list.

Formally, for each test case you are given an integer \(N\) and a sequence \(a_1, a_2, \dots, a_N\). Let \(S\) be the set of unique elements in the sequence. You must compute \[ \text{result} = \sum_{x \in S} x. \]

Input is read from standard input and output is printed to standard output.

inputFormat

The first line contains an integer \(T\) \( (1 \leq T \leq 100)\) denoting the number of test cases.

For each test case, the first line contains an integer \(N\) \( (0 \leq N \leq 10^5)\) indicating the number of elements. The second line contains \(N\) positive integers separated by spaces.

outputFormat

For each test case, output a single line containing the sum of unique elements.

## sample
2
5
1 2 3 2 1
4
5 5 5 5
6

5

</p>