#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(), (a).end() const ll mod = 1e9 + 7; int main() { cin.tie(nullptr); int T; cin >> T; rep(test, 0, T) { int N; cin >> N; ll ans = 1; rep(i, 0, N) { ll A; cin >> A; ans *= (A + 1); ans %= mod; } ans = ans - 1 + mod; cout << ans % mod << '\n'; } }