9031 - Subset sum   

Description

Given N numbers. You need to separate them A and B such that is minimum.

Input

Each case starts with a positive integer N (1 <= N <= 20), then the next line contains exactly N integers (range from -100000 to 100000).

A test case of N = 0 indicates the end of input, and should not be processed.

Output

Output one line per case that contains an integer denoting the minimum value of .

Sample Input  Download

Sample Output  Download

Tags




Discuss