405860: GYM102136 B Even answer
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
B. Even answertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output1 ≤ N ≤ 105 - 109 ≤ ai ≤ 109 Output
Vanya has an array of N integers a1, a2, ..., aN. He wants to calculate the sum of these numbers. But he also wants the sum to be non-negative, even and minimum possible at the same time. So, he decided to multiply one of the numbers by any integer before adding the numbers.
Help Vanya to get the sum he wants.
InputThe first line of input contains an integer N — the size of the array A.
In the next line there are N integers a1, a2, ..., aN — the elements of the array A.
Output a single integer — the required sum. If there is no answer then output -1.
ExamplesInput2Output
7 3
4Input
2Output
7 10
10Input
3Output
42 43 86
42