Welcome to ZOJ
Information
Select Problem
Runs
Ranklist
ZOJ Problem Set - 2868
Incredible Cows

Time Limit: 2 Seconds      Memory Limit: 32768 KB

Farmer John is well known for his great cows. Recently, the cows have decided to participate in the Incredible Cows Puzzle Contest (ICPC).

Farmer John wants to divide the cows into two teams, and he wants to minimize the difference of Puzzle Solving Power of two teams.

Puzzle Solving Power of a team is sum of Puzzle Solving Power of cows forming that team.

Help F.J. to find the minimum difference!

Input

The first line of input consists of a single integer T, the number of test-cases. Each test-case consists of a line containing n (2 <= n <= 34), number of cows. n lines follow. i-th line contains the Puzzle Solving Power of i-th cow. Puzzle Solving Power of a cow is a non-negative number less than 10,000,000. There is a blank line between two consecutive test-cases.

Output

For each test-case, output a line containing the minimum difference which can be achieved.

Sample Input

2
3
12
6
6

10
123
455
1000
403
234
554
129
454
84
11

Sample Output

0
5


Author: Hadi Moshayedi
Source: AUT Contest 1
Submit    Status