You are given an array $$A$$ of $$N$$ integers. Now there is another integer $$X$$ which is unknown but you know its properties. The properties of the unknown number are:
$$1$$. It is an integer.
$$2$$. If you subtract all the elements of the array $$A$$ individually from the number $$X$$ and add all the differences then it adds to $$0$$.
Your goal is to find the number $$X$$.
Input
The first line contains an integer $$T$$ denoting the total number of test cases.
The first line of each test case contains an integer $$N$$ as input.
Next line of each test case contains $$N$$ space separated integers.
Output
In the output you need to print the number $$X$$ if it exists or else you need to print $$-1$$.
Constraints
$$1 \le T \le 10$$
$$1 \le N \le 10^5$$
$$1 \le A[i] \le 10^9$$
If you subtract all the integers from 2 the sum of difference is $$1 + 0 + (-1) = 0$$.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor