import sys

s = sys.stdin
T = int(s.readline())

for i in xrange(T):
    N = int(s.readline())
    A = map(int, s.readline().split())
    Total = sum(A)
    f = min(A)
    if f == 1:
        print -1
    else:
        print Total - f + 2