On the eve of Republic Day, Teacher decided to distribute candies among  N  students.She brought the candies in a box and
placed it in front of students. She allowed every student to take out some candies. But each one of them tried
to take out as much candies as possible. That's why, Not all students were happy. She called all students and
requested for their bags of candies. Now she wants to distribute candies equally among all bags. She'll be performing
two operations.

Pick up a candy from a bag.
Put a candy into another bag.

	Both operations require 1 unit of time. You are given with bags of N students with number of candies
in it. You have to check whether candies can be distributed equally among all bags or not. If it can be distributed then
calculate the time required for total distribution.

Input

First Line contains number of test cases T.
Every test case consist of two lines, First line contains N i.e. Number of Bags and next line contains N
space separated integers A1, A2, ..., AN , where i^th integer
indicates number of candies in i^th bag.

 

Output

If candies can be distributed equally then output the time required for distribution in new line,
else, output "-1" (without quotes) in new line.

 

Constraints

1 ≤ T ≤ 10
1 ≤ N ≤ 100
0 ≤ Number of Candies in each bag ≤ 1000

 

Example
Input:
3
3
1 2 3
3
1 2 1
4
9 7 8 0

Output:
2
-1
12
 

Explanation
Example case 1.Teacher picks up a candy from a bag with maximum candies i.e. 3^rd bag and put it in the bag with minimum candies i.e. 1^st bag. Now all bags have two candies each. Total time required for distribution is 2.
T = int(raw_input())
for t in range(T):
    tot =0
    n = int(raw_input())
    a = map(int,raw_input().split())
    m = sum(a)
    if m%n!=0:
        print -1
    else:
        for i in range(n):
            if abs(a[i]-m//n) >0:
                tot += abs(a[i]-m//n)
        print tot