#include <stdio.h>
int main() {
int c, tmp=1;
long long num=0, p[100];
int mod = 1000000007;
scanf("%d", &c);
for(int i=0;i<c;i++) {
scanf("%lld", &p[i]);
}
for(int i=0;i<c;i++) {
if(i>0) {
num=(num+p[i]+((i+1)*(mod+p[i-1]-1))+(tmp+mod-p[i-1]))%mod;
p[i]=(p[i]+(mod+p[i-1]-1)*(i+1))%mod;
tmp=(tmp*(i+1))%mod;
}
else
num=(num+p[i])%mod;
printf("%lld\n", num%mod);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1088 KB |
Output is correct |
2 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |