Munna has an array $$$A$$$ of $$$N$$$ integers, where $$$N$$$ is an odd number. He enjoys playing with these integers. Initially, his score is $$$0$$$.
In each turn, as long as the array contains at least three elements, he will perform the following operations:
Now, Munna wants to know the maximum possible value of the final remaining element, under the condition that his final score is odd, assuming he plays optimally.
The first line contains a single integer $$$N (1 \leq N \lt 2⋅10^5)$$$, the number of elements in the array.
The second line contains $$$N$$$ space-separated integers $$$A_1, A_2, \ldots, A_N$$$ $$$(1 \leq A_i \leq 10^9)$$$.
Note: It is guranteed that $$$N$$$ is always odd.
If it's impossible to obtain a final odd score output $$$-1$$$.
Otherwise, output the maximum possible value of the final remaining element in the array.
5 3 4 7 8 1
8
3 2 2 2
-1
For the first test case:
At this point, only one element remains, and the final score is $$$13$$$, which is odd. The remaining element is $$$8$$$, which is the maximum possible under this condition..
For the second test case:
It can be shown that it is impossible to obtain a final odd score, regardless of the operations performed.