#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
;
const long long maxn = 19;
const long long maxk = 10;
const long long maxst = 1024;
const long long mod = 998244353;
long long k;
pair<long long, long long> D1[maxn][maxst][2];
long long st2[maxn];
long long st10[maxn];
bool M[maxst][maxk];
long long C[maxst];
bool M1[maxk];
bool M2[maxk];
long long solve(string l) {
  if (l == "") {
    return 0;
  }
  long long q, w, e, t, y;
  long long n = l.length();
  long long ans = 0;
  long long s = 0;
  for (q = 0; q < n; q++) {
    for (e = 0; e < l[q] - '0'; e++) {
      for (y = n - q - 1; y < n - q; y++) {
        for (w = 0; w < maxst; w++) {
          long long c = 0;
          for (t = 0; t < maxk; t++) {
            M2[t] = M1[t] || M[w][t];
            if (t == e && (s != 0 || e != 0)) {
              M2[t] = 1;
            }
            c += M2[t];
          }
          if (c <= k - 1) {
            ans += (s + (e * st10[n - q - 1]) % mod) *
                       ((D1[y][w][0].second + D1[y][w][1].second) % mod) +
                   D1[y][w][0].first + D1[y][w][1].first;
            ans %= mod;
            continue;
          }
          if (c == k) {
            ans +=
                (s + (e * st10[n - q - 1]) % mod) * (D1[y][w][0].second % mod) +
                D1[y][w][0].first;
            ans %= mod;
            if ((s == 0 && e == 0) || M2[0]) {
              ans += (s + (e * st10[n - q - 1]) % mod) *
                         (D1[y][w][1].second % mod) +
                     D1[y][w][1].first;
              ans %= mod;
            }
          }
        }
      }
    }
    M1[l[q] - '0'] = 1;
    s += (l[q] - '0') * st10[n - q - 1];
    s %= mod;
  }
  long long c = 0, cnt = 0;
  ;
  for (q = 0; q < maxk; q++) {
    cnt += M1[q];
    M1[q] = 0;
  }
  for (q = 0; q < n; q++) {
    c *= 10;
    c += l[q] - '0';
    c %= mod;
  }
  if (cnt <= k) {
    ans += c;
    ans %= mod;
  }
  return ans;
}
int main() {
  long long q, w, e, n, m, t;
  string l = "", r;
  st2[0] = 1;
  st10[0] = 1;
  for (q = 1; q < maxn; q++) {
    st2[q] = st2[q - 1] * 2;
    st10[q] = st10[q - 1] * 10;
    st10[q] %= mod;
  }
  for (q = 0; q < maxst; q++) {
    long long q1 = q;
    long long c = maxst;
    long long i = 10;
    long long cnt = 0;
    while (c != 0) {
      if (c <= q1) {
        q1 -= c;
        M[q][i] = 1;
        cnt++;
      }
      i--;
      c /= 2;
    }
    C[q] = cnt;
  }
  long long L;
  cin >> L >> r >> k;
  L--;
  while (L != 0) {
    l = (char)(L % 10 + '0') + l;
    L /= 10;
  }
  D1[0][0][0] = make_pair(0, 1);
  for (q = 0; q < maxn - 1; q++) {
    for (w = 0; w < maxst; w++) {
      for (e = 0; e < maxk; e++) {
        for (t = 0; t < 2; t++) {
          long long nmsk;
          long long t1 = t;
          if (M[w][e]) {
            nmsk = w;
          } else {
            if (w == 0 && e == 0) {
              nmsk = 0;
              t1 = 1;
            } else {
              nmsk = w + st2[e];
            }
          }
          D1[q + 1][nmsk][t1].first =
              (D1[q + 1][nmsk][t1].first + D1[q][w][t].first * 10 +
               D1[q][w][t].second * e) %
              mod;
          D1[q + 1][nmsk][t1].second =
              (D1[q + 1][nmsk][t1].second + D1[q][w][t].second) % mod;
        }
      }
    }
  }
  cout << (solve(r) - solve(l) + 2 * mod) % mod;
  return 0;
}

### Prompt

Develop a solution in cpp to the problem described below:

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>
#pragma GCC optimize("O3")
using namespace std;
;
const long long maxn = 19;
const long long maxk = 10;
const long long maxst = 1024;
const long long mod = 998244353;
long long k;
pair<long long, long long> D1[maxn][maxst][2];
long long st2[maxn];
long long st10[maxn];
bool M[maxst][maxk];
long long C[maxst];
bool M1[maxk];
bool M2[maxk];
long long solve(string l) {
  if (l == "") {
    return 0;
  }
  long long q, w, e, t, y;
  long long n = l.length();
  long long ans = 0;
  long long s = 0;
  for (q = 0; q < n; q++) {
    for (e = 0; e < l[q] - '0'; e++) {
      for (y = n - q - 1; y < n - q; y++) {
        for (w = 0; w < maxst; w++) {
          long long c = 0;
          for (t = 0; t < maxk; t++) {
            M2[t] = M1[t] || M[w][t];
            if (t == e && (s != 0 || e != 0)) {
              M2[t] = 1;
            }
            c += M2[t];
          }
          if (c <= k - 1) {
            ans += (s + (e * st10[n - q - 1]) % mod) *
                       ((D1[y][w][0].second + D1[y][w][1].second) % mod) +
                   D1[y][w][0].first + D1[y][w][1].first;
            ans %= mod;
            continue;
          }
          if (c == k) {
            ans +=
                (s + (e * st10[n - q - 1]) % mod) * (D1[y][w][0].second % mod) +
                D1[y][w][0].first;
            ans %= mod;
            if ((s == 0 && e == 0) || M2[0]) {
              ans += (s + (e * st10[n - q - 1]) % mod) *
                         (D1[y][w][1].second % mod) +
                     D1[y][w][1].first;
              ans %= mod;
            }
          }
        }
      }
    }
    M1[l[q] - '0'] = 1;
    s += (l[q] - '0') * st10[n - q - 1];
    s %= mod;
  }
  long long c = 0, cnt = 0;
  ;
  for (q = 0; q < maxk; q++) {
    cnt += M1[q];
    M1[q] = 0;
  }
  for (q = 0; q < n; q++) {
    c *= 10;
    c += l[q] - '0';
    c %= mod;
  }
  if (cnt <= k) {
    ans += c;
    ans %= mod;
  }
  return ans;
}
int main() {
  long long q, w, e, n, m, t;
  string l = "", r;
  st2[0] = 1;
  st10[0] = 1;
  for (q = 1; q < maxn; q++) {
    st2[q] = st2[q - 1] * 2;
    st10[q] = st10[q - 1] * 10;
    st10[q] %= mod;
  }
  for (q = 0; q < maxst; q++) {
    long long q1 = q;
    long long c = maxst;
    long long i = 10;
    long long cnt = 0;
    while (c != 0) {
      if (c <= q1) {
        q1 -= c;
        M[q][i] = 1;
        cnt++;
      }
      i--;
      c /= 2;
    }
    C[q] = cnt;
  }
  long long L;
  cin >> L >> r >> k;
  L--;
  while (L != 0) {
    l = (char)(L % 10 + '0') + l;
    L /= 10;
  }
  D1[0][0][0] = make_pair(0, 1);
  for (q = 0; q < maxn - 1; q++) {
    for (w = 0; w < maxst; w++) {
      for (e = 0; e < maxk; e++) {
        for (t = 0; t < 2; t++) {
          long long nmsk;
          long long t1 = t;
          if (M[w][e]) {
            nmsk = w;
          } else {
            if (w == 0 && e == 0) {
              nmsk = 0;
              t1 = 1;
            } else {
              nmsk = w + st2[e];
            }
          }
          D1[q + 1][nmsk][t1].first =
              (D1[q + 1][nmsk][t1].first + D1[q][w][t].first * 10 +
               D1[q][w][t].second * e) %
              mod;
          D1[q + 1][nmsk][t1].second =
              (D1[q + 1][nmsk][t1].second + D1[q][w][t].second) % mod;
        }
      }
    }
  }
  cout << (solve(r) - solve(l) + 2 * mod) % mod;
  return 0;
}

```