Tuple of Integers

AtCoder
IDfps_24_b
Time2000ms
Memory256MB
Difficulty
You are given an integer $N$. Find the number of non-negative integer quadruples $(a, b, c, d)$ that satisfy all of the following conditions, and output the result modulo $998244353$: * $a + b + c + d = N$ * $a$ is $0$ or $1$ * $b$ is $0$, $1$, or $2$ * $c$ is even * $d$ is a multiple of $3$ ## Constraints * $0 \leq N \leq 10^9$ * $N$ is an integer ## Input The input is given from standard input in the following format: $N$ [samples]
Samples
Input #1
5
Output #1
6

The following $6$ quadruples $(a,b,c,d)$ satisfy the conditions:

*   $(0,0,2,3)$
*   $(0,1,4,0)$
*   $(0,2,0,3)$
*   $(1,0,4,0)$
*   $(1,1,0,3)$
*   $(1,2,2,0)$
Input #2
1000000000
Output #2
1755648
API Response (JSON)
{
  "problem": {
    "name": "Tuple of Integers",
    "description": {
      "content": "You are given an integer $N$.   Find the number of non-negative integer quadruples $(a, b, c, d)$ that satisfy all of the following conditions, and output the result modulo $998244353$: *   $a + b + ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "fps_24_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given an integer $N$.  \nFind the number of non-negative integer quadruples $(a, b, c, d)$ that satisfy all of the following conditions, and output the result modulo $998244353$:\n\n*   $a + b + ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments