問題一覧 > 通常問題

No.1081 和の和

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 416
作問者 : tyawanmusi / テスター : V.ll
お気に入りにしたユーザー ProblemId : 3824 / 自分の提出
問題文最終更新日: 2023-04-24 18:25:27
Sum of Sums
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
yukicoder contest 253 (順位表) の他の問題:

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})$
Find the remainder when $A_1$ after the operations is divided by $10^9+7$.

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もしくは右上の雲マークをクリックしてアカウントを作成してください。