#include <bits/stdc++.h>
using namespace std;
const long long maxn = 510;
const long long INF = 1e18;
long long l, r, k, dp[20][(1 << 10) + 2][10], cnt[20][(1 << 10) + 2][10],
    mod = 998244353;
long long poww(long long a, long long b) {
  if (b == 0) return 1;
  long long x = poww(a, b / 2) % mod;
  if (b & 1)
    return (((x * x) % mod) * a) % mod;
  else
    return (x * x) % mod;
}
long long solve(long long x) {
  for (int i = 0; i < 20; i++)
    for (int mask = 0; mask < (1 << 10); mask++)
      for (int j = 0; j < 10; j++) dp[i][mask][j] = cnt[i][mask][j] = 0;
  vector<long long> ragh;
  set<long long> ss;
  long long xx = x;
  while (xx) {
    ragh.push_back(xx % 10);
    ss.insert(xx % 10);
    xx /= 10;
  }
  long long n = ragh.size();
  for (int mask = 0; mask < (1 << 10); mask++) {
    for (int i = 0; i < 10; i++) {
      if (mask ^ (1 << i)) continue;
      cnt[0][mask][i] = 1;
      dp[0][mask][i] = i;
    }
  }
  for (long long i = 1; i < n; i++) {
    for (int mask = 0; mask < (1 << 10); mask++) {
      for (int j = 0; j < 10; j++) {
        if (!(mask & (1 << j))) continue;
        long long sum = 0, te = 0, va = (poww(10ll, i) * j) % mod;
        for (int z = 0; z < 10; z++) {
          sum = (sum + (dp[i - 1][mask][z] % mod) +
                 (cnt[i - 1][mask][z] * va) % mod) %
                mod;
          te = (te + cnt[i - 1][mask][z] % mod) % mod;
          sum = (sum + (dp[i - 1][mask ^ (1 << j)][z] % mod) +
                 ((cnt[i - 1][mask ^ (1 << j)][z] * va) % mod)) %
                mod;
          te = (te + (cnt[i - 1][mask ^ (1 << j)][z] % mod)) % mod;
        }
        dp[i][mask][j] = sum % mod;
        cnt[i][mask][j] = te % mod;
      }
    }
  }
  long long ans = 0, va = 0, sum = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (i == n - 1) {
      for (int j = 1; j < ragh[i]; j++) {
        for (int mask = 0; mask < (1 << 10); mask++) {
          if (!(mask & (1 << j))) continue;
          if (__builtin_popcount(mask | va) > k) continue;
          ans = (ans + dp[i][mask][j] % mod + (cnt[i][mask][j] * sum) % mod) %
                mod;
        }
      }
      for (int j = n - 2; j >= 0; j--)
        for (int mask = 0; mask < (1 << 10); mask++)
          for (int z = 1; z < 10; z++)
            if (__builtin_popcount(mask) <= k)
              ans = (ans + dp[j][mask][z] % mod) % mod;
    } else {
      for (int j = 0; j < ragh[i]; j++) {
        for (int mask = 0; mask < (1 << 10); mask++) {
          if (!(mask & (1 << j))) continue;
          if (__builtin_popcount(mask | va) > k) continue;
          ans = (ans + dp[i][mask][j] % mod + (cnt[i][mask][j] * sum) % mod) %
                mod;
        }
      }
    }
    va = (va | (1 << ragh[i]));
    sum = (sum + (poww(10, i) * ragh[i]) % mod) % mod;
  }
  if (ss.size() <= k) ans = (ans + x) % mod;
  return ans % mod;
}
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> l >> r >> k;
  cout << (solve(r) - solve(l - 1) + mod) % mod;
  return 0;
}

### Prompt

In Cpp, your task is to solve the following problem:

You are given two integers l and r (l ≤ r). Your task is to calculate the sum of numbers from l to r (including l and r) such that each number contains at most k different digits, and print this sum modulo 998244353.

For example, if k = 1 then you have to calculate all numbers from l to r such that each number is formed using only one digit. For l = 10, r = 50 the answer is 11 + 22 + 33 + 44 = 110.

Input

The only line of the input contains three integers l, r and k (1 ≤ l ≤ r < 10^{18}, 1 ≤ k ≤ 10) — the borders of the segment and the maximum number of different digits.

Output

Print one integer — the sum of numbers from l to r such that each number contains at most k different digits, modulo 998244353.

Examples

Input

10 50 2


Output

1230


Input

1 2345 10


Output

2750685


Input

101 154 2


Output

2189

Note

For the first example the answer is just the sum of numbers from l to r which equals to (50 ⋅ 51)/(2) - (9 ⋅ 10)/(2) = 1230. This example also explained in the problem statement but for k = 1.

For the second example the answer is just the sum of numbers from l to r which equals to (2345 ⋅ 2346)/(2) = 2750685.

For the third example the answer is 101 + 110 + 111 + 112 + 113 + 114 + 115 + 116 + 117 + 118 + 119 + 121 + 122 + 131 + 133 + 141 + 144 + 151 = 2189.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long maxn = 510;
const long long INF = 1e18;
long long l, r, k, dp[20][(1 << 10) + 2][10], cnt[20][(1 << 10) + 2][10],
    mod = 998244353;
long long poww(long long a, long long b) {
  if (b == 0) return 1;
  long long x = poww(a, b / 2) % mod;
  if (b & 1)
    return (((x * x) % mod) * a) % mod;
  else
    return (x * x) % mod;
}
long long solve(long long x) {
  for (int i = 0; i < 20; i++)
    for (int mask = 0; mask < (1 << 10); mask++)
      for (int j = 0; j < 10; j++) dp[i][mask][j] = cnt[i][mask][j] = 0;
  vector<long long> ragh;
  set<long long> ss;
  long long xx = x;
  while (xx) {
    ragh.push_back(xx % 10);
    ss.insert(xx % 10);
    xx /= 10;
  }
  long long n = ragh.size();
  for (int mask = 0; mask < (1 << 10); mask++) {
    for (int i = 0; i < 10; i++) {
      if (mask ^ (1 << i)) continue;
      cnt[0][mask][i] = 1;
      dp[0][mask][i] = i;
    }
  }
  for (long long i = 1; i < n; i++) {
    for (int mask = 0; mask < (1 << 10); mask++) {
      for (int j = 0; j < 10; j++) {
        if (!(mask & (1 << j))) continue;
        long long sum = 0, te = 0, va = (poww(10ll, i) * j) % mod;
        for (int z = 0; z < 10; z++) {
          sum = (sum + (dp[i - 1][mask][z] % mod) +
                 (cnt[i - 1][mask][z] * va) % mod) %
                mod;
          te = (te + cnt[i - 1][mask][z] % mod) % mod;
          sum = (sum + (dp[i - 1][mask ^ (1 << j)][z] % mod) +
                 ((cnt[i - 1][mask ^ (1 << j)][z] * va) % mod)) %
                mod;
          te = (te + (cnt[i - 1][mask ^ (1 << j)][z] % mod)) % mod;
        }
        dp[i][mask][j] = sum % mod;
        cnt[i][mask][j] = te % mod;
      }
    }
  }
  long long ans = 0, va = 0, sum = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (i == n - 1) {
      for (int j = 1; j < ragh[i]; j++) {
        for (int mask = 0; mask < (1 << 10); mask++) {
          if (!(mask & (1 << j))) continue;
          if (__builtin_popcount(mask | va) > k) continue;
          ans = (ans + dp[i][mask][j] % mod + (cnt[i][mask][j] * sum) % mod) %
                mod;
        }
      }
      for (int j = n - 2; j >= 0; j--)
        for (int mask = 0; mask < (1 << 10); mask++)
          for (int z = 1; z < 10; z++)
            if (__builtin_popcount(mask) <= k)
              ans = (ans + dp[j][mask][z] % mod) % mod;
    } else {
      for (int j = 0; j < ragh[i]; j++) {
        for (int mask = 0; mask < (1 << 10); mask++) {
          if (!(mask & (1 << j))) continue;
          if (__builtin_popcount(mask | va) > k) continue;
          ans = (ans + dp[i][mask][j] % mod + (cnt[i][mask][j] * sum) % mod) %
                mod;
        }
      }
    }
    va = (va | (1 << ragh[i]));
    sum = (sum + (poww(10, i) * ragh[i]) % mod) % mod;
  }
  if (ss.size() <= k) ans = (ans + x) % mod;
  return ans % mod;
}
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> l >> r >> k;
  cout << (solve(r) - solve(l - 1) + mod) % mod;
  return 0;
}

```