T = int(input()) ans = [] mod = 10**9+7 #A+B+A*B=(A+1)*(B+1)-1 for i in range(T): N = int(input()) lsA = list(map(int,input().split())) c = 1 for j in range(N): c *= (lsA[j]+1) c %= mod c -= 1 ans.append(c) for i in range(T): print(ans[i])