Problem: 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.

Examples

Input

1


Output

9


Input

2


Output

98


Input

123


Output

460191684


Input

36018


Output

966522825


Input

1000


Output

184984484

Solution (in CPP):

Solution:
    #include <cstdio>
    #include <iostream>
    #include <vector>
    #include <set>
    #include <map>
    #include <cmath>
    #include <string>
    #include <cstring>
    #include <sstream>
    #include <queue>
    #include <iomanip>
    #include <algorithm>
    using namespace std;
     
    typedef long long ll;
     
    const int Maxd = 10;
    const int Maxm = 6000000;
    const int mod = 1000000007;
     
    int pw[Maxd];
    int s;
    int got[Maxm];
    int res;
     
    int toPower(int a, int p)
    {
    	int res = 1;
    	while (p) {
    		if (p & 1) res = ll(res) * a % mod;
    		p >>= 1; a = ll(a) * a % mod;
    	}
    	return res;
    }
     
    int main()
    {
    	pw[0] = 1;
    	for (int i = 1; i < Maxd; i++)
    		pw[i] = 10 * pw[i - 1];
    	scanf("%d", &s);
    	int add = 0;
    	int sum = 0;
    	int cur = 0;
    	got[0]++;
    	for (int i = 1; ; i++) {
    		if (i == pw[cur]) { add++; cur++; }
    		sum += add;
    		if (sum - s >= Maxm) break;
    		if (sum >= s) res = (res + got[sum - s]) % mod;
    		if (i < pw[6] - 1) got[sum]++;
    	}
    	if (s % 7 == 0) {
    		int nd = s / 7;
    		if (nd <= 9 * pw[6]) res = (res + 9 * pw[6] - nd + 1) % mod;
    	}
    	for (int i = 1; i * i <= s; i++)
    		if (s % i == 0) {
    			if (i > 7) {
    				int nd = s / i;
    				res = (ll(res) + 9ll * toPower(10, i - 1) % mod - ll(nd) + 1ll + ll(mod)) % mod;
    			}
    			if (i != s / i && s / i > 7) {
    				int nd = i;
    				res = (ll(res) + 9ll * toPower(10, s / i - 1) % mod - ll(nd) + 1ll + ll(mod)) % mod;
    			}
    		}
    	for (int b = 1; b * 8 < s; b++) {
    		int lft = s - b * 8;
    		if (lft % 7 == 0) {
    			int a = lft / 7;
    			if (a <= 9 * pw[6]) res = (res + 1) % mod;
    		}
    	}
    	for (int x = 9; x < s; x++) {
    		ll lft = s - x;
    		lft -= ll(x) * (lft % (x - 1));
    		if (lft <= 0) continue;
            ll cand = lft / (ll(x) * (x - 1));
            if (cand * x * (x - 1) != lft) cand++;
    		res = (res + cand) % mod;
    	}
    	printf("%d\n", res);
    	return 0;
    }