P. Reconstruct Sum
题号:NC223980
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

On a whiteboard, you have found a list of integers. Is it possible to use all of them to write down a correct arithmetic expression where one of them is the sum of all the others? 
You may not alter the integers in any way (e.g., changing the sign or concatenating).

输入描述:

The first line of input contains an integer n (1 ≤ n ≤ 104), representing the number of integers onthe whiteboard.
The integers on the whiteboard are given over the next n lines, one per line. Their absolute valuesare guaranteed to be at most 105. 

输出描述:

Print a single integer x which is one of the inputs, and is the sum of all the others. If there’s more than one such x, output any one. If there are no such values of x, output the string ‘BAD’.
示例1

输入

复制
4
1
6
3
2

输出

复制
6
示例2

输入

复制
4
-2
0
5
-3

输出

复制
0
示例3

输入

复制
5
1
10
4
2
-3

输出

复制
BAD