atcoder#ABC297H. [ABC297Ex] Diff Adjacent

[ABC297Ex] Diff Adjacent

Score : 600600 points

Problem Statement

A positive-integer sequence is said to be splendid if no two adjacent elements are equal.

Find the sum, modulo 998244353998244353, of the lengths of all splendid sequences whose elements have a sum of NN.

Constraints

  • 1N2×1051 \le N \le 2 \times 10^5
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN

Output

Print the answer.

4
8

There are four splendid sequences whose sum is 44: (4),(1,3),(3,1),(1,2,1)(4),(1,3),(3,1),(1,2,1). Thus, the answer is the sum of their lengths: 1+2+2+3=81+2+2+3=8.

(2,2)(2,2) and (1,1,2)(1,1,2) also have a sum of 44 but ineligible because their 11-st and 22-nd elements are the same.

297
475867236
123456
771773807