atcoder#ABC288F. [ABC288F] Integer Division

[ABC288F] Integer Division

Score : 500500 points

Problem Statement

You are given a positive integer XX with NN digits in decimal representation. None of the digits of XX is 00. For a subset SS of {1,2,,N1}\lbrace 1,2, \ldots, N-1 \rbrace, let f(S)f(S) be defined as follows.

See the decimal representation of XX as a string of length NN, and decompose it into S+1|S| + 1 strings by splitting it between the ii-th and (i+1)(i + 1)-th characters if and only if iSi \in S. Then, see these S+1|S| + 1 strings as integers in decimal representation, and let f(S)f(S) be the product of these S+1|S| + 1 integers.

There are 2N12^{N-1} subsets of {1,2,,N1}\lbrace 1,2, \ldots, N-1 \rbrace, including the empty set, which can be SS. Find the sum of f(S)f(S) over all these SS, modulo 998244353998244353.

Constraints

  • 2N2×1052 \leq N \leq 2 \times 10^5
  • XX has NN digits in decimal representation, none of which is 00.
  • All values in the input are integers.

Input

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

NN

XX

Output

Print the answer.

3
234
418

For S=S = \emptyset, we have f(S)=234f(S) = 234. For S={1}S = \lbrace 1 \rbrace, we have f(S)=2×34=68f(S) = 2 \times 34 = 68. For S={2}S = \lbrace 2 \rbrace, we have f(S)=23×4=92f(S) = 23 \times 4 = 92. For S={1,2}S = \lbrace 1, 2 \rbrace, we have f(S)=2×3×4=24f(S) = 2 \times 3 \times 4 = 24. Thus, you should print 234+68+92+24=418234 + 68 + 92 + 24 = 418.

4
5915
17800
9
998244353
258280134