No.1081 和の和
タグ : / 解いたユーザー数 416
作問者 :
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
Problem Statement
Chawanmushi-kun has an integer sequence $A$ with $N$ elements. The $i(1 \le i \le N)$-th element of $A$ is $A_i$.
Chawanmushi-kun performs the following operation $N-1$ times. (Please refer to Sample 1.)
- In the $i$-th operation, replace $A$ with $(A_1+A_2,A_2+A_3,\dots,A_{N-i}+A_{N-i+1})$
Constraints
- All inputs are integers
- $2 \le N \le 100$
- $0 \le A_i \le 10^9$
Input
$N$
$A_1\ A_2\ \dots\ A_N$
The $1$st line contains $N$.
The $2$nd line contains $A$ before the operations, separated by spaces.
Output
Print the remainder when $A_1$ after the operations is divided by $10^9+7$ on 1 line.
Print a newline at the end.
Sample
Sample 1
Input
4
3 10 100 1000
Output
1333
$A$ changes as follows.
$(3,10,100,1000)$→$(13,110,1100)$→$(123,1210)$→$(1333)$
Sample 2
Input
3
0 0 0
Output
0
Sample 3
Input
5
1000000000 1000000000 1000000000 1000000000 1000000000
Output
999999895
Find the remainder when divided by $10^9+7$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。