def ingr(l):
    s=0
    minfreq=l[0]
    for i in range(0,len(l),1):
        if l[i]<2:
            return -1
    for i in range(0,len(l),1):
        s+=l[i]
        minfreq=min(minfreq,l[i])
    return (s-minfreq+2)
t=int(input())
while t:
    t=t-1
    n=int(raw_input())
    l=list(map(int,raw_input().split()))
    print(ingr(l))