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 *= A[i] + 1 ans %= mod ans -= 1 ans %= mod print(ans)