9323: ABC297 —— Ex - Diff Adjacent
[Creator : ]
Description
A positive-integer sequence is said to be splendid if no two adjacent elements are equal.
Find the sum, modulo $998244353$, of the lengths of all splendid sequences whose elements have a sum of $N$.
Find the sum, modulo $998244353$, of the lengths of all splendid sequences whose elements have a sum of $N$.
Input
The input is given from Standard Input in the following format:
```
$N$
```
```
$N$
```
Output
Print the answer.
Constraints
$1 \le N \le 2 \times 10^5$
All values in the input are integers.
All values in the input are integers.
Sample 1 Input
4
Sample 1 Output
8
There are four splendid sequences whose sum is 4: (4),(1,3),(3,1),(1,2,1). Thus, the answer is the sum of their lengths: 1+2+2+3=8.
(2,2) and (1,1,2) also have a sum of 4 but ineligible because their 1-st and 2-nd elements are the same.
(2,2) and (1,1,2) also have a sum of 4 but ineligible because their 1-st and 2-nd elements are the same.
Sample 2 Input
297
Sample 2 Output
475867236
Sample 3 Input
123456
Sample 3 Output
771773807