#include <bits/stdc++.h>
using namespace std;
using ll = long long;
pair<ll, ll> dp[20][(1 << 10)][2];
vector<ll> getDigit(ll n) {
  vector<ll> ret;
  while (n) {
    ret.push_back(n % 10);
    n /= 10;
  }
  reverse(ret.begin(), ret.end());
  return ret;
}
ll powee(ll x, ll n) {
  if (n == 0ll) return 1ll;
  if (n == 1ll) return x;
  ll ret = powee(x, n / 2) % 998244353;
  if (!(n & 1)) return ret * ret % 998244353;
  return ret * ret % 998244353 * x % 998244353;
}
int cnt_msk(int mask) {
  int ret = 0;
  for (int i = 0; i <= 9; i++)
    if (mask & (1 << i)) ret++;
  return ret;
}
pair<ll, ll> f(int idx, int mask, bool tight, vector<ll> digit, int k, ll num) {
  if (cnt_msk(mask) > k) {
    return make_pair(0ll, 0ll);
  }
  ll sz = digit.size();
  if (idx == sz and cnt_msk(mask) <= k) return make_pair(num % 998244353, 1ll);
  if (dp[idx][mask][tight].first != -1) {
    return make_pair((dp[idx][mask][tight].first +
                      num * powee(10ll, (sz - idx)) % 998244353 *
                          dp[idx][mask][tight].second % 998244353) %
                         998244353,
                     dp[idx][mask][tight].second % 998244353);
  }
  int lmt = tight ? digit[idx] : 9ll;
  dp[idx][mask][tight] = make_pair(0ll, 0ll);
  for (ll i = 0ll; i <= lmt; i++) {
    pair<ll, ll> tmp;
    if (num == 0ll and i == 0ll)
      tmp = f(idx + 1, mask, tight and i == lmt, digit, k, 0ll);
    else
      tmp = f(idx + 1, mask | (1 << i), tight and i == lmt, digit, k,
              (num * 10ll + i) % 998244353);
    dp[idx][mask][tight].first += tmp.first;
    dp[idx][mask][tight].second += tmp.second;
    dp[idx][mask][tight].second %= 998244353;
    dp[idx][mask][tight].first %= 998244353;
  }
  dp[idx][mask][tight].first -= (num * powee(10ll, sz - idx) % 998244353 *
                                 dp[idx][mask][tight].second % 998244353);
  if (dp[idx][mask][tight].first < 0) dp[idx][mask][tight].first += 998244353;
  return make_pair((dp[idx][mask][tight].first +
                    num * powee(10ll, (sz - idx)) % 998244353 *
                        dp[idx][mask][tight].second % 998244353) %
                       998244353,
                   dp[idx][mask][tight].second % 998244353);
}
void reset_dp() {
  for (int i = 0; i < 20; i++)
    for (int j = 0; j < (1 << 10); j++)
      for (int v = 0; v < 2; v++) dp[i][j][v] = make_pair(-1ll, -1ll);
}
ll solve(ll l, ll r, int k) {
  vector<ll> v_l_1 = getDigit(l - 1);
  vector<ll> v_r = getDigit(r);
  reset_dp();
  auto res_l_1 = f(0, 0, 1, v_l_1, k, 0ll);
  reset_dp();
  auto res_r = f(0, 0, 1, v_r, k, 0ll);
  ll res = res_r.first - res_l_1.first;
  if (res < 0) res += 998244353;
  res %= 998244353;
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll l, r, k;
  cin >> l >> r >> k;
  cout << solve(l, r, k) << '\n';
  return 0;
}

### Prompt

Please provide a Cpp coded solution 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>
using namespace std;
using ll = long long;
pair<ll, ll> dp[20][(1 << 10)][2];
vector<ll> getDigit(ll n) {
  vector<ll> ret;
  while (n) {
    ret.push_back(n % 10);
    n /= 10;
  }
  reverse(ret.begin(), ret.end());
  return ret;
}
ll powee(ll x, ll n) {
  if (n == 0ll) return 1ll;
  if (n == 1ll) return x;
  ll ret = powee(x, n / 2) % 998244353;
  if (!(n & 1)) return ret * ret % 998244353;
  return ret * ret % 998244353 * x % 998244353;
}
int cnt_msk(int mask) {
  int ret = 0;
  for (int i = 0; i <= 9; i++)
    if (mask & (1 << i)) ret++;
  return ret;
}
pair<ll, ll> f(int idx, int mask, bool tight, vector<ll> digit, int k, ll num) {
  if (cnt_msk(mask) > k) {
    return make_pair(0ll, 0ll);
  }
  ll sz = digit.size();
  if (idx == sz and cnt_msk(mask) <= k) return make_pair(num % 998244353, 1ll);
  if (dp[idx][mask][tight].first != -1) {
    return make_pair((dp[idx][mask][tight].first +
                      num * powee(10ll, (sz - idx)) % 998244353 *
                          dp[idx][mask][tight].second % 998244353) %
                         998244353,
                     dp[idx][mask][tight].second % 998244353);
  }
  int lmt = tight ? digit[idx] : 9ll;
  dp[idx][mask][tight] = make_pair(0ll, 0ll);
  for (ll i = 0ll; i <= lmt; i++) {
    pair<ll, ll> tmp;
    if (num == 0ll and i == 0ll)
      tmp = f(idx + 1, mask, tight and i == lmt, digit, k, 0ll);
    else
      tmp = f(idx + 1, mask | (1 << i), tight and i == lmt, digit, k,
              (num * 10ll + i) % 998244353);
    dp[idx][mask][tight].first += tmp.first;
    dp[idx][mask][tight].second += tmp.second;
    dp[idx][mask][tight].second %= 998244353;
    dp[idx][mask][tight].first %= 998244353;
  }
  dp[idx][mask][tight].first -= (num * powee(10ll, sz - idx) % 998244353 *
                                 dp[idx][mask][tight].second % 998244353);
  if (dp[idx][mask][tight].first < 0) dp[idx][mask][tight].first += 998244353;
  return make_pair((dp[idx][mask][tight].first +
                    num * powee(10ll, (sz - idx)) % 998244353 *
                        dp[idx][mask][tight].second % 998244353) %
                       998244353,
                   dp[idx][mask][tight].second % 998244353);
}
void reset_dp() {
  for (int i = 0; i < 20; i++)
    for (int j = 0; j < (1 << 10); j++)
      for (int v = 0; v < 2; v++) dp[i][j][v] = make_pair(-1ll, -1ll);
}
ll solve(ll l, ll r, int k) {
  vector<ll> v_l_1 = getDigit(l - 1);
  vector<ll> v_r = getDigit(r);
  reset_dp();
  auto res_l_1 = f(0, 0, 1, v_l_1, k, 0ll);
  reset_dp();
  auto res_r = f(0, 0, 1, v_r, k, 0ll);
  ll res = res_r.first - res_l_1.first;
  if (res < 0) res += 998244353;
  res %= 998244353;
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll l, r, k;
  cin >> l >> r >> k;
  cout << solve(l, r, k) << '\n';
  return 0;
}

```