There are cities in Byteland, and the
city has a value
. The cost of building a bidirectional road between two cities is the sum of their values. Please calculate the minimum cost of connecting these cities, which means any two cities can reach each other.
The first line is an integer
representing the number of test cases.
For each test case, the first line is an integer, representing the number of cities, the
second line arepositive integers
![]()
,
representing their values.
For each test case, output an integer, which is the
minimum cost of connecting these cities.