Keep On Movin

아직 제출이 없습니다시간 제한1초메모리 제한64 MB

문제

Professor Zhang has nn kinds of characters, and the quantity of the ii-th character is a_ia\_i. Professor Zhang wants to use all the characters to build several palindromic strings. He also wants to maximize the length of the shortest palindromic string.

For example, let there be 44 kinds of characters denoted as 'a', 'b', 'c', 'd', and let their quantities be 2,3,2,2\\{2, 3, 2, 2\\}, respectively. Professor Zhang can build ("acdbbbdca"), or ("abbba" and "cddc"), or ("aca", "bbb" and "dcd"), or ("acdbdca and "bb"). The first is the optimal solution where the length of the shortest palindromic string is 99.

Note that a string is called palindromic if it can be read the same way in either direction.

입력

There are multiple test cases. The first line of input contains an integer TT indicating the number of test cases. For each test case:

The first line contains an integer nn (1n1051 \le n \le 10^5): the number of kinds of characters. The second line contains nn integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n (0a_i1040 \le a\_i \le 10^4).

There are at most 110110 test cases, and the total size of the input is at most 66 mebibytes.

출력

For each test case, output an integer denoting the answer.