atcoder#ARC090D. [ARC090F] Number of Digits

[ARC090F] Number of Digits

Score : 900900 points

Problem Statement

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

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

Constraints

  • 1S1081 \leq S \leq 10^8

Input

Input is given from Standard Input in the following format:

SS

Output

Print the answer.

1
9

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

2
98

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

123
460191684
36018
966522825
1000
184984484