#P3977. Subset

Subset

Description

Given a list of N integers with absolute values no larger than 10

15

, find a non empty subset of these numbers which minimizes the absolute value of the sum of its elements. In case there are multiple subsets, choose the one with fewer elements.

Input

The input contains multiple data sets, the first line of each data set contains N <= 35, the number of elements, the next line contains N numbers no larger than 10

15

in absolute value and separated by a single space. The input is terminated with N = 0

Output

For each data set in the input print two integers, the minimum absolute sum and the number of elements in the optimal subset.

1
10
3
20 100 -100
0
10 1
0 2

Source

Seventh ACM Egyptian National Programming Contest