#include using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) int main(){ int T; scanf("%d",&T); while(T--){ int N; scanf("%d",&N); ULL X[100]; rep(i,N) scanf("%llu",&X[i]); const ULL M=1000000007; ULL ans=1; rep(i,N) ans=ans*(X[i]+1)%M; ans+=M-1; printf("%llu\n",ans%M); } return 0; }