Sum of Subarrays
Submissions: 4537   Accuracy:


  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 (109+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 <= 105
1 <= A[] <= 1000

Input :

1 2 3
1 3

Output :

** 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, generate link and share the link here.

to report an issue on this page.