Redistribution SOLUTIONS AtCoder Contest 178

Redistribution SOLUTION

Problem Statement
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 
3, and whose sum is equal to S. The answer can be very large, so output it modulo 109+7.
 
Constraints
1S2000
All values in input are integers.
 
Input
Input is given from Standard Input in the following format:
S
 
Output
Print the answer.
 
Sample Input 1 
Copy
7
Sample Output 1 
Copy
3
3
 sequences satisfy the condition: 
{3,4}{4,3} and {7}.
 
Sample Input 2 
Copy
2
Sample Output 2 
Copy
0
There are no sequences that satisfy the condition.
 
Sample Input 3 
Copy
1729
Sample Output 3 
Copy
294867501

Leave a Comment