#include using namespace std; #define int long long typedef pair P; int INF = 3e18+7; int mod = 1e9+7; int dx[] = {1, 0,-1, 0, 1, 1,-1,-1}; int dy[] = {0, 1, 0,-1, 1,-1, 1,-1}; signed main() { int T; cin >> T; while (T--) { int N; cin >> N; vectorA(N); for(int i = 0; i < N; i++) { cin >> A[i]; } int sum = A[0]; for(int i = 1; i < N; i++) { sum = (sum+A[i])+(sum*A[i]); sum %= mod; } cout << sum << endl; } }