200903: [AtCoder]ARC090 F - Number of Digits

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $900$ points

Problem Statement

For a positive integer $n$, let us define $f(n)$ as the number of digits in base $10$.

You are given an integer $S$. Count the number of the pairs of positive integers $(l, r)$ ($l \leq r$) such that $f(l) + f(l + 1) + ... + f(r) = S$, and find the count modulo $10^9 + 7$.

Constraints

  • $1 \leq S \leq 10^8$

Input

Input is given from Standard Input in the following format:

$S$

Output

Print the answer.


Sample Input 1

1

Sample Output 1

9

There are nine pairs $(l, r)$ that satisfies the condition: $(1, 1)$, $(2, 2)$, $...$, $(9, 9)$.


Sample Input 2

2

Sample Output 2

98

There are $98$ pairs $(l, r)$ that satisfies the condition, such as $(1, 2)$ and $(33, 33)$.


Sample Input 3

123

Sample Output 3

460191684

Sample Input 4

36018

Sample Output 4

966522825

Sample Input 5

1000

Sample Output 5

184984484

Input

题意翻译

对于一个正整数 $n$,设 $f(n)$ 表示它在十进制下的位数。如:$f(1234)=4, f(33)=2, f(101)=3$。给定 $k\ (k\le 10^8)$ ,求正整数对 $(l,r)\ (l\le r)$ 的个数,使得$\sum_{i=l}^{r} f(i)=k$。例子:当 $k=1$时,有九组:$(1,1),(2,2),...,(9,9)$。答案对 $10^9+7$ 取模。

加入题单

上一题 下一题 算法标签: