#D12957. Divide Cake into Five
Divide Cake into Five
Divide Cake into Five
Divide Cake into Five
Segtree is a quintuplet tutor. Today is Christmas Eve, so I'm trying to divide the round cake into five equal parts for the quintuplets.
The cake is divided into pieces from the center in a fan shape, th and th (), th and The second piece is next to each other.
The size of the th piece is . If the sum of the sizes of all the pieces is , then is guaranteed to be a multiple of for all inputs.
Given a non-negative integer . How to divide a cake into quintuplets that meet the following conditions is called "cake quintet".
- Everyone takes one or more pieces.
- The pieces each take in the cake are connected. In other words, when the pieces are grouped by the taker, there is no set of pieces in the same group that cannot be reached repeatedly by moving to the same group and adjacent pieces.
- There is no piece that no one takes.
- For everyone, if the size of the piece to be taken is , it always satisfies .
Find out how many different ways to divide the cake so that it becomes "five equal parts of the cake".
input
Input is given from standard input in the following format.
output
Please output the number according to how to divide the cake so that it becomes "five equal parts of the cake".
However, insert a line break at the end.
Constraint
- All inputs are integers.
Input example 1
5 0 1 1 1 1 1
Output example 1
1
Input example 2
10 27 3 1 4 1 5 9 2 6 5 4
Output example 2
252
Example
Input
5 0 1 1 1 1 1
Output
1
inputFormat
inputs.
Given a non-negative integer . How to divide a cake into quintuplets that meet the following conditions is called "cake quintet".
- Everyone takes one or more pieces.
- The pieces each take in the cake are connected. In other words, when the pieces are grouped by the taker, there is no set of pieces in the same group that cannot be reached repeatedly by moving to the same group and adjacent pieces.
- There is no piece that no one takes.
- For everyone, if the size of the piece to be taken is , it always satisfies .
Find out how many different ways to divide the cake so that it becomes "five equal parts of the cake".
input
Input is given from standard input in the following format.
outputFormat
output
Please output the number according to how to divide the cake so that it becomes "five equal parts of the cake".
However, insert a line break at the end.
Constraint
- All inputs are integers.
Input example 1
5 0 1 1 1 1 1
Output example 1
1
Input example 2
10 27 3 1 4 1 5 9 2 6 5 4
Output example 2
252
Example
Input
5 0 1 1 1 1 1
Output
1
样例
5 0
1 1 1 1 1
1