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