题库练习 Two Sorts
← 上一题 下一题 →

A14578 | Two Sorts

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Integers from $1$ to $n$ (inclusive) were sorted lexicographically (considering integers as strings). As a result, array $a_1, a_2, \dots, a_n$ was obtained.

Calculate value of $(\sum_{i = 1}^n ((i - a_i) \mod 998244353)) \mod 10^9 + 7$ .

$x \mod y$ here means the remainder after division $x$ by $y$ . This remainder is always non-negative and doesn't exceed $y - 1$ . For example, $5 \mod 3 = 2$ , $(-1) \mod 6 = 5$ .

输入格式

The first line contains the single integer $n$ ( $1 \leq n \leq 10^{12}$ ).

输出格式

Print one integer — the required sum.

输入输出样例

输入 #1
3
输出 #1
0
输入 #2
12
输出 #2
994733045
输入 #3
21
输出 #3
978932159
输入 #4
1000000000000
输出 #4
289817887
C++ 编辑器
输入
输出