mod=1000000007 T=int(input()) for i in range(T): N=int(input()) A=list(map(int,input().split())) A=[i+1 for i in A] ans=1 for i in A: ans*=i print((ans-1)%mod)