After placements, all the boys of CSE branch have no work to do. So, they decide to play CSE Cricket Premier League. There are N teams. For every match played, the winner gets 2 points and losing team gets 0 points. If the outcome is draw, both teams get 1 points each. Different teams may have played different number of matches.
Given the number of teams and the points obtained by each of them, find the minimum number of matches that have been played in the tournament. If the points doesn't represent a valid state, print -1.
First line contains the number of test cases. Every test is consists of two lines. First line contains a single integer N. Second line contains N integers representing the points (Pi) of N teams .
For every test case print the minimum number of matches that have been played in the tournament. If the points doesn't represent a valid state, print -1.
T <= 100
N <= 100
0 <= Pi <= 100
Sample Test Cases
10 1 1
1 1 1
0 0 0 0 0 0
13 8 7
Problem Setter : Shikhar Sharad