Sum of Subarrays
Submissions: 4327   Accuracy:

21.63%

  Difficulty: Medium   Marks: 4

Given an array A with N elements , you need to find the sum all sub arrays of array A. Since the sum could be very large print the sum modulo (10^9+7).

Input :
The first line contains integer T, denoting number of test cases. The first line of each test case contains an integer N, denoting the number of elements.The second line of each test case contains N space separated integers denoting values of the array A.


Output :
Print the answer of each test case in a new line.

Constraints :
1<=T<=100
1<=N<=10^5

Example
Input :

2
3
1 2 3
2
1 3

Output :
20
8

** For More Input/Output Examples Use 'Expected Output' option **

Author: Sonesh Shukla


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.