#ARC153E. [ARC153E] Deque Minimization

[ARC153E] Deque Minimization

Score : 800800 points

Problem Statement

For a positive integer XX none of whose digits is 00, consider obtaining a positive integer YY as follows.

  • Initialize SS as an empty string.
  • Let NN be the number of digits in XX. For i=1,,Ni = 1, \ldots, N in this order, do the following: insert the ii-th character in the decimal notation of XX at the beginning or end of SS.
  • Let YY be the positive integer represented by the string SS.

Let f(X)f(X) denote the minimum positive integer that can be obtained from XX in this way.


You are given a positive integer YY none of whose digits is 00. Print the number, modulo 998244353998244353, of positive integers XX none of whose digits is 00 such that f(X)=Yf(X) = Y.

Constraints

  • YY is a positive integer none of whose digits is 00.
  • 1Y<102000001\leq Y < 10^{200000}

Input

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

YY

Output

Print the number, modulo 998244353998244353, of positive integers XX none of whose digits is 00 such that f(X)=Yf(X) = Y.

1332
3

Three integers, 13321332, 31323132, and 33123312, satisfy the conditions.

3312
0
12234433442
153