//#include #include #include #include #include #include #include #include // string, to_string, stoi #include // vector #include // min, max, swap, sort, reverse, lower_bound, upper_bound #include // pair, make_pair #include // tuple, make_tuple #include // int64_t, int*_t #include // printf #include // map #include // queue, priority_queue #include // set #include // stack #include // deque #include // unordered_map #include // unordered_set #include // bitset #include // isupper, islower, isdigit, toupper, tolower using namespace std; //using namespace atcoder; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using Graph = vector>; vector ISP; ll M = 1500005; void PP(ll M) { ISP.assign(M + 1, -1); for (ll i = 2; i <= M; i++) { ISP[i] = i; } ISP[0] = -1; ISP[1] = -1; for (ll i = 2; i * i <= M; i++) { if (ISP[i] == i) { for (ll j = 2; i * j <= M; j++) { if (ISP[i * j] != i * j)continue; ISP[i * j] = i; } } } } vector Dk(70); ll mod = 1e9 + 7; void Ks(ll K) { rep(i, 70) { Dk[i] = 0; } Dk[0] = K; rep(i, 69) { Dk[i + 1] = Dk[i] * Dk[i]; Dk[i + 1] %= mod; } } ll GG(ll Ps) { ll P = Ps; ll res = 1; rep(i, 70) { if (P % 2 != 0) { res *= Dk[i]; res %= mod; } P /= 2; } return res; } int main() { ll T; cin >> T; ll M = 1e9 + 7; rep(t, T) { ll N; cin >> N; ll an = 1;; rep(i, N) { ll AN; cin >> AN; an *= (AN + 1); an %= M; } cout << (an-1+M)%M << endl; } }