#K53847. Special Integer

    ID: 29622 Type: Default 1000ms 256MiB

Special Integer

Special Integer

Given an array of integers, your task is to find a "special integer" x in the array such that it satisfies the equation:

$$2x = \sum_{i=1}^{n} a_i$$

In other words, x should be equal to the sum of all the other integers in the array. If such an integer exists, output it; otherwise, output -1. Note that if the sum of all numbers is not even, then no such integer x can exist.

It is guaranteed that the input will contain at least one integer.

inputFormat

The first line contains a single integer n, the number of elements in the array.

The second line contains n space-separated integers representing the array elements.

outputFormat

Output a single integer which is the special integer if it exists; otherwise, output -1.

## sample
4
1 2 3 6
6