Redistribution

AtCoder
IDabc178_d
Time2000ms
Memory256MB
Difficulty
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 $10^9 + 7$. ## Constraints * $1 \leq S \leq 2000$ * All values in input are integers. ## Input Input is given from Standard Input in the following format: $S$ [samples]
Samples
Input #1
7
Output #1
3

$3$ sequences satisfy the condition: ${3,4}$, ${4,3}$ and ${7}$.
Input #2
2
Output #2
0

There are no sequences that satisfy the condition.
Input #3
1729
Output #3
294867501
API Response (JSON)
{
  "problem": {
    "name": "Redistribution",
    "description": {
      "content": "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 $",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc178_d"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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 $...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments