'''
T = int(raw_input())
while T:
    L = [i for i in raw_input().split()]
    d = {pos: color for pos,color in zip(list('FKLRTB'),L)}
    possible_pos = ['FBL','RBK','FRB','KLB','FLT','FRT','RKT','LKT']
    for position in possible_pos:
        for i in range(2):
            if d[position[i]] != d[position[i+1]]: break
        else: print 'YES'; break
    else: print 'NO'
    T -= 1
from collections import deque
import sys
N,M = map(int,raw_input().split())
L = [[] for i in range(N)]
for i in range(N): u,v = map(int,raw_input().split()); L[u-1].append((v-1,0)); L[v-1].append((u-1,1))
def BFS(G,s):
    dq = deque([s]); l = len(G)
    dist = [sys.maxint for i in range(l)]; dist[s] = 0
    while dq:
        vertex = dq.popleft()
        for vi in G[vertex]:
            if dist[vi[0]] > dist[vertex] + vi[1]:
                dist[vi[0]] = dist[vertex] + vi[1]
                if vi[1] == 0: dq.appendleft(vi[0])
                else: dq.append(vi[0])
    return dist[l - 1]
print BFS(L,0)
T = int(raw_input())
while T:
    s = raw_input().strip(); c = 0
    for i in s:
        if i not in ['4','7']: c += 1
    print c; T -= 1
'''
T = int(raw_input())
while T:
    N = int(raw_input()); L = [int(i) for i in raw_input().split()]
    m = min(L)
    if m == 1: print -1
    else: print sum(L) - m + 2
    T -= 1