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