Problem9539--ABC238 —— C - digitnum

9539: ABC238 —— C - digitnum

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

Given an integer $N$, solve the following problem.

Let $f(x)=$ (The number of positive integers at most $x$ with the same number of digits as $x$).  
Find $f(1)+f(2)+\dots+f(N)$ modulo $998244353$.

Input

Input is given from Standard Input in the following format:

```
$N$
```

Output

Print the answer as an integer.

Constraints

-   $N$ is an integer.
-   $1 \le N < 10^{18}$

Sample 1 Input

16

Sample 1 Output

73
  • For a positive integer x between 1 and 9, the positive integers at most x with the same number of digits as x are 1,2,…,x.
    • Thus, we have f(1)=1,f(2)=2,...,f(9)=9.
  • For a positive integer x between 10 and 16, the positive integers at most x with the same number of digits as x are 10,11,…,x.
    • Thus, we have f(10)=1,f(11)=2,...,f(16)=7.

The final answer is 73.

Sample 2 Input

238

Sample 2 Output

13870

Sample 3 Input

999999999999999999

Sample 3 Output

762062362

Source/Category