atcoder#ABC242C. [ABC242C] 1111gal password

[ABC242C] 1111gal password

Score : 300300 points

Problem Statement

Given an integer NN, find the number of integers XX that satisfy all of the following conditions, modulo 998244353998244353.

  • XX is an NN-digit positive integer.
  • Let X1,X2,,XNX_1,X_2,\dots,X_N be the digits of XX from top to bottom. They satisfy all of the following:- 1Xi91 \le X_i \le 9 for all integers 1iN1 \le i \le N;
    • XiXi+11|X_i-X_{i+1}| \le 1 for all integers 1iN11 \le i \le N-1.

Constraints

  • NN is an integer.
  • 2N1062 \le N \le 10^6

Input

Input is given from Standard Input in the following format:

NN

Output

Print the answer as an integer.

4
203

Some of the 44-digit integers satisfying the conditions are 1111,1234,7878,65451111,1234,7878,6545.

2
25
1000000
248860093

Be sure to find the count modulo 998244353998244353.