#agc020c. [agc020_c]Median Sum
[agc020_c]Median Sum
Problem Statement
You are given integers , , ..., .
Consider the sums of all non-empty subsequences of . There are such sums, an odd number.
Let the list of these sums in non-decreasing order be , , ..., .
Find the median of this list, .
Constraints
- All input values are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the median of the sorted list of the sums of all non-empty subsequences of .
Sample Input 1
3
1 2 1
Sample Output 1
2
In this case, . Its median is .
Sample Input 2
1
58
Sample Output 2
58
In this case, .