fork(1) download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. int t, n, pre, ans, mod = 1000000007, tmp;
  5.  
  6. int main() {
  7. scanf("%d", &t);
  8. while (t--) {
  9. scanf("%d", &n);
  10. scanf("%d", &tmp);
  11. for (int i = 1; i < n; ++i) {
  12. pre = tmp;
  13. scanf("%d", &tmp);
  14. tmp = (ll(pre + 1) * tmp + pre) % mod;
  15. }
  16. cout << tmp << endl;
  17. }
  18. return 0;
  19. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty