#include <bits/stdc++.h>
using namespace std;
const long long B = 1e6, D = 6, mod1 = 998244353, mod2 = 1e9 + 7;
vector<long long> vec[10];
long long sum[10];
long long calc(long long u) { return (u % mod1 + mod1) % mod1; }
long long tot = 0, cnt = 0;
long long n, ans = 0;
void solve(long long u) {
  if (u > n) return;
  if (u * B > n / 10 && u * B + B - 1 <= n) {
    long long tmp = 1;
    for (long long i = 0; i <= D; ++i, tmp *= 10) {
      long long A = calc(cnt - tmp * u);
      long long pos =
          lower_bound(vec[i].begin(), vec[i].end(), mod1 - A) - vec[i].begin();
      ans = (ans + 1ll * A * vec[i].size() + sum[i] -
             1ll * mod1 * (vec[i].size() - pos)) %
            mod2;
    }
    cnt += tot;
    return;
  }
  ++cnt, ans = (ans + calc(cnt - u)) % mod2;
  for (long long i = 0; i < 10; ++i) solve(u * 10 + i);
}
void dfs(long long u, long long dep) {
  if (dep > D) return;
  ++tot, vec[dep].push_back(calc(tot - u));
  for (long long i = 0; i < 10; ++i) dfs(u * 10 + i, dep + 1);
}
pair<string, long long> b[5000005];
void print() {
  for (long long i = 1; i <= n; ++i) b[i] = {to_string(i), i};
  sort(b + 1, b + n + 1);
  long long res = 0;
  for (long long i = 1; i <= n; ++i) res = (res + calc(i - b[i].second)) % mod2;
  cout << res << "\n";
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n;
  dfs(0, 0);
  for (long long i = 0; i <= D; ++i)
    sort(begin(vec[i]), end(vec[i])),
        sum[i] = accumulate(begin(vec[i]), end(vec[i]), 0ll) % mod2;
  for (long long i = 1; i < 10; ++i) solve(i);
  cout << (ans % mod2 + mod2) % mod2 << "\n";
}

### Prompt

Your task is to create a Cpp solution to the following problem:

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

Calculate value of (∑_{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. 

Input

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

Output

Print one integer — the required sum.

Examples

Input


3


Output


0


Input


12


Output


994733045


Input


21


Output


978932159


Input


1000000000000


Output


289817887

Note

A string a is lexicographically smaller than a string b if and only if one of the following holds:

  * a is a prefix of b, but a ≠ b; 
  * in the first position where a and b differ, the string a has a letter that appears earlier in the alphabet than the corresponding letter in b. 



For example, 42 is lexicographically smaller than 6, because they differ in the first digit, and 4 < 6; 42 < 420, because 42 is a prefix of 420.

Let's denote 998244353 as M.

In the first example, array a is equal to [1, 2, 3]. 

  * (1 - 1) mod M = 0 mod M = 0 
  * (2 - 2) mod M = 0 mod M = 0 
  * (3 - 3) mod M = 0 mod M = 0 



As a result, (0 + 0 + 0) mod 10^9 + 7 = 0

In the second example, array a is equal to [1, 10, 11, 12, 2, 3, 4, 5, 6, 7, 8, 9]. 

  * (1 - 1) mod M = 0 mod M = 0 
  * (2 - 10) mod M = (-8) mod M = 998244345 
  * (3 - 11) mod M = (-8) mod M = 998244345 
  * (4 - 12) mod M = (-8) mod M = 998244345 
  * (5 - 2) mod M = 3 mod M = 3 
  * (6 - 3) mod M = 3 mod M = 3 
  * (7 - 4) mod M = 3 mod M = 3 
  * (8 - 5) mod M = 3 mod M = 3 
  * (9 - 6) mod M = 3 mod M = 3 
  * (10 - 7) mod M = 3 mod M = 3 
  * (11 - 8) mod M = 3 mod M = 3 
  * (12 - 9) mod M = 3 mod M = 3 



As a result, (0 + 998244345 + 998244345 + 998244345 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3) mod 10^9 + 7 = 2994733059 mod 10^9 + 7 = 994733045

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long B = 1e6, D = 6, mod1 = 998244353, mod2 = 1e9 + 7;
vector<long long> vec[10];
long long sum[10];
long long calc(long long u) { return (u % mod1 + mod1) % mod1; }
long long tot = 0, cnt = 0;
long long n, ans = 0;
void solve(long long u) {
  if (u > n) return;
  if (u * B > n / 10 && u * B + B - 1 <= n) {
    long long tmp = 1;
    for (long long i = 0; i <= D; ++i, tmp *= 10) {
      long long A = calc(cnt - tmp * u);
      long long pos =
          lower_bound(vec[i].begin(), vec[i].end(), mod1 - A) - vec[i].begin();
      ans = (ans + 1ll * A * vec[i].size() + sum[i] -
             1ll * mod1 * (vec[i].size() - pos)) %
            mod2;
    }
    cnt += tot;
    return;
  }
  ++cnt, ans = (ans + calc(cnt - u)) % mod2;
  for (long long i = 0; i < 10; ++i) solve(u * 10 + i);
}
void dfs(long long u, long long dep) {
  if (dep > D) return;
  ++tot, vec[dep].push_back(calc(tot - u));
  for (long long i = 0; i < 10; ++i) dfs(u * 10 + i, dep + 1);
}
pair<string, long long> b[5000005];
void print() {
  for (long long i = 1; i <= n; ++i) b[i] = {to_string(i), i};
  sort(b + 1, b + n + 1);
  long long res = 0;
  for (long long i = 1; i <= n; ++i) res = (res + calc(i - b[i].second)) % mod2;
  cout << res << "\n";
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n;
  dfs(0, 0);
  for (long long i = 0; i <= D; ++i)
    sort(begin(vec[i]), end(vec[i])),
        sum[i] = accumulate(begin(vec[i]), end(vec[i]), 0ll) % mod2;
  for (long long i = 1; i < 10; ++i) solve(i);
  cout << (ans % mod2 + mod2) % mod2 << "\n";
}

```