Problem2195--ABC238C - digitnum

2195: ABC238C - digitnum

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

Problem Statement

Given an integer NN, solve the following problem.
Let f(x)=f(x)= (The number of positive integers at most xx with the same number of digits as xx).
Find f(1)+f(2)+\dots+f(N)f(1)+f(2)++f(N) modulo 998244353998244353.

Constraints

  • NN is an integer.
  • 1 \le N < 10^{18}1N<1018

Input

Input is given from Standard Input in the following format:
NN

Output

Print the answer as an integer.

Sample Input Copy

16

Sample Output Copy

73

HINT

sample 1:
  • For a positive integer xx between 11 and 99, the positive integers at most xx with the same number of digits as xx are 1,2,\dots,x1,2,,x.
    • Thus, we have f(1)=1,f(2)=2,...,f(9)=9f(1)=1,f(2)=2,...,f(9)=9.
  • For a positive integer xx between 1010 and 1616, the positive integers at most xx with the same number of digits as xx are 10,11,\dots,x10,11,,x.
    • Thus, we have f(10)=1,f(11)=2,...,f(16)=7f(10)=1,f(11)=2,...,f(16)=7.

The final answer is 7373.


Source/Category