mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
596be6ae11
5000-5099
36 lines
666 B
C++
36 lines
666 B
C++
#include<iostream>
|
|
#include<cstdio>
|
|
#include<string.h>
|
|
#define MAX 10000007
|
|
#define LL __int64
|
|
using namespace std;
|
|
int n;
|
|
LL a[MAX];
|
|
int main()
|
|
{
|
|
LL t,m,i,j,sum,xx=1000000007;
|
|
scanf("%I64d",&t);
|
|
while(t--)
|
|
{
|
|
scanf("%I64d",&n);
|
|
for(j=1; j<=n; j++)
|
|
{
|
|
scanf("%I64d",&a[j]);
|
|
}
|
|
a[0] = 0;
|
|
for(j=1;j<=n;j++)
|
|
{
|
|
a[j] = a[j]*j+a[j-1];
|
|
a[j] = a[j]%xx;
|
|
}
|
|
sum = 0;
|
|
for(j=1;j<=n;j++)
|
|
{
|
|
sum = sum+a[j];
|
|
sum = sum%xx;
|
|
}
|
|
printf("%I64d\n",sum);
|
|
}
|
|
return 0;
|
|
}
|