第五回日本最強プログラマー学生選手権-予選-(AtCoder Regular Contest 180)
C
Subsequence and Prefix Sum
AtCoder
⌀ 2221
原题
← BD →
翻译中…

Problem Statement

翻译中…

You are given an integer sequence $A=(A_1,A_2,\cdots,A_N)$ of length $N$.

翻译中…

You will perform the following operation exactly once:

翻译中…
  • Choose a non-empty subsequence of $A$ (not necessarily contiguous) and replace it with its cumulative sums. More precisely, first choose a sequence of indices $(i_1,i_2,\cdots,i_k)$ such that $1 \leq i_1 < i_2 < \cdots < i_k \leq N$. The length of the sequence $k$ ($1 \leq k \leq N$) can be chosen freely. Then, for each $j$ ($1 \leq j \leq k$), replace the value of $A_{i_j}$ with $\sum_{1 \leq x \leq j} A_{i_x}$. This replacement is done simultaneously for all chosen indices.
翻译中…

Find, modulo $10^9+7$, the number of possible sequences $A$ after the operation.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 100$
  • $-10 \leq A_i \leq 10$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N
A_1 A_2 \cdots A_N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
3
1 1 2
Output #1
4
The possible sequences $A$ after the operation are as follows: - $A=(1,1,2)$: This can be achieved with $k=1$ and $(i_1)=(1)$. - $A=(1,2,2)$: This can be achieved with $k=2$ and $(i_1,i_2)=(1,2)$. - $A=(1,1,3)$: This can be achieved with $k=2$ and $(i_1,i_2)=(1,3)$. - $A=(1,2,4)$: This can be achieved with $k=3$ and $(i_1,i_2,i_3)=(1,2,3)$.
Input #2
4
1 -1 1 -1
Output #2
8
Input #3
5
0 0 0 0 0
Output #3
1
Input #4
40
2 -2 1 3 -3 -1 -2 -3 0 -1 -2 0 -3 0 0 2 0 -1 2 -2 -2 -1 3 -2 -2 -2 2 3 2 -3 0 -2 2 1 3 0 -1 0 -2 -3
Output #4
420429545
题目信息

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。