#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <bitset>

using namespace std;

const int MAXN = 20;
const int MAXK = (1 << 10);
const int MOD = 998244353;

struct pt
{
    int x, y;
    pt()
    {
        x = 0;
        y = 0;
    }
    pt(int _x, int _y)
    {
        x = _x; y = _y;
    }
};

long long l, r;
int k;
int b_pow[MAXN];
pt T[MAXN][MAXK][2];
int b_count[MAXK];

int add(int f1, int f2)
{
    int z = (f1 + f2) % MOD;
    if(z < 0) z += MOD;
    return z;
}

int mult(int f1, int f2)
{
    return (1LL * f1 * f2) % MOD;
}

void read_input()
{
    scanf("%I64d %I64d %d", &l, &r, &k);

    b_pow[0] = 1;
    for(int i = 1; i < MAXN; i++)
    {
        b_pow[i] = (b_pow[i - 1] * 10) % MOD;
    }

    for(int i = 0; i < MAXK; i++)
    {
        b_count[i] = __builtin_popcount(i);
    }
}

int calcDp(string s, int len)
{
    for(int i = 0; i < MAXN; i++)
    {
        for(int j = 0; j < MAXK; j++)
        {
            T[i][j][0] = pt();
            T[i][j][1] = pt();
        }
    }

    for(int mask = s[0] - '0'; mask > 0; mask--)
    {
        //printf("%d\n", mask);
        //cout << bitset<10>(1 << mask) << " " << mask << "\n";
        if(mask == s[0] - '0')
        {
            T[0][(1 << mask)][1] = pt(mask, 1);
        }
        else
        {
            T[0][(1 << mask)][0] = pt(mask, 1);
        }
    }

    for(int i = 1; i < len; i++)
    {
        int temp = s[i] - '0';
        for(int mask = 0; mask < MAXK; mask++)
        {
            for(int z = 0; z <= 9; z++)
            {
                if((mask & (1 << z)))
                {
                    int cnt = T[i - 1][mask ^ (1 << z)][0].y;
                    int sum = T[i - 1][mask ^ (1 << z)][0].x;

                    int cnt2 = T[i - 1][mask ^ (1 << z)][1].y;
                    int sum2 = T[i - 1][mask ^ (1 << z)][1].x;

                    int cnt3 = T[i - 1][mask][0].y;
                    int sum3 = T[i - 1][mask][0].x;

                    int cnt4 = T[i - 1][mask][1].y;
                    int sum4 = T[i - 1][mask][1].x;

                    if(z == temp)
                    {
                        T[i][mask][1] = pt(add(T[i][mask][1].x, add(add(add(mult(sum3, 10), mult(cnt3, z)) ,add(mult(sum4, 10), mult(cnt4, z))) , add(add(mult(sum2, 10), mult(cnt2, z)) ,add(mult(sum, 10), mult(cnt, z))))), add(T[i][mask][1].y, add(add(cnt3, cnt4), add(cnt, cnt2))));
                    }
                    else if(z < temp)
                    {
                        T[i][mask][0] = pt(add(T[i][mask][0].x ,add(add(add(mult(sum3, 10), mult(cnt3, z)) ,add(mult(sum4, 10), mult(cnt4, z))) , add(add(mult(sum2, 10), mult(cnt2, z)) ,add(mult(sum, 10), mult(cnt, z))))), add(T[i][mask][0].y, add(add(cnt3, cnt4), add(cnt, cnt2))));
                    }
                    else
                    {
                        T[i][mask][0] = pt(add(T[i][mask][0].x, add(add(mult(sum, 10), mult(cnt, z)), add(mult(sum3, 10), mult(cnt3, z)))), add(T[i][mask][0].y, add(cnt, cnt3)));
                    }
                }

            }
        }
    }

    int ans = 0;

    for(int i = 0; i < MAXK; i++)
    {
        if(b_count[i] <= k)
        {
            ans = add(ans, T[len - 1][i][0].x);
            ans = add(ans, T[len - 1][i][1].x);
        }
    }

    return ans;
}

int calc(long long t)
{
    int len = to_string(t).size();

    int ans = 0;

    for(int i = len - 1; i > 0; i--)
    {
        ans = add(ans, calcDp(string(i, '9'), i));
    }

    //printf("%d\n", ans);

    ans = add(ans, calcDp(to_string(t), len));

    return ans;
}

int main()
{
    read_input();
    printf("%d\n", add(calc(r), -calc(l - 1)));

    return 0;
}

/*
1 10 2
*/


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <bitset>

using namespace std;

const int MAXN = 20;
const int MAXK = (1 << 10);
const int MOD = 998244353;

struct pt
{
    int x, y;
    pt()
    {
        x = 0;
        y = 0;
    }
    pt(int _x, int _y)
    {
        x = _x; y = _y;
    }
};

long long l, r;
int k;
int b_count[MAXK];
pt T[MAXN][MAXK][2];

int add(int f1, int f2)
{
    f1 += f2;
    if(f1 >= MOD) f1 %= MOD;
    if(f1 < 0) f1 += MOD;
    return f1;
}

int mult(int f1, int f2)
{
    return (1LL * f1 * f2) % MOD;
}

void read_input()
{
    scanf("%I64d %I64d %d", &l, &r, &k);

    for(int i = 0; i < MAXK; i++)
    {
        b_count[i] = __builtin_popcount(i);
    }
}

int calcDp(string s, int len)
{
    for(int i = 0; i < MAXN; i++)
    {
        for(int j = 0; j < MAXK; j++)
        {
            T[i][j][0] = pt();
            T[i][j][1] = pt();
        }
    }

    T[0][0][1] = pt(0, 1);

    for(int i = 0; i < len; i++)
    {
        int temp = s[i] - '0';
        for(int mask = 0; mask < MAXK; mask++)
        {
            if(T[i][mask][0].y == 0 && T[i][mask][1].y == 0) continue;
            for(int j = (i == 0); j < 10; j++)
            {
                int nmask = mask | (1 << j);
                int cnt = T[i][mask][0].y;
                int sum = add(mult(T[i][mask][0].x, 10), mult(cnt, j));

                T[i + 1][nmask][0].x = add(T[i + 1][nmask][0].x, sum);
                T[i + 1][nmask][0].y = add(T[i + 1][nmask][0].y, cnt);
            }
            for(int j = (i == 0); j <= temp; j++)
            {
                int nmask = mask | (1 << j);
                int cnt = T[i][mask][1].y;
                int sum = add(mult(T[i][mask][1].x, 10), mult(cnt, j));

                T[i + 1][nmask][j == temp].x = add(T[i + 1][nmask][j == temp].x, sum);
                T[i + 1][nmask][j == temp].y = add(T[i + 1][nmask][j == temp].y, cnt);
            }
        }
    }

    int ans = 0;

    for(int i = 0; i < MAXK; i++)
    {
        if(b_count[i] <= k)
        {
            ans = add(ans, T[len][i][0].x);
            ans = add(ans, T[len][i][1].x);
        }
    }

    return ans;
}

int calc(long long t)
{
    int len = to_string(t).size();

    int ans = 0;

    for(int i = 1; i < len; i++)
    {
        ans = add(ans, calcDp(string(i, '9'), i));
    }

    ans = add(ans, calcDp(to_string(t), len));

    return ans;
}

int main()
{
    read_input();
    printf("%d\n", add(calc(r), -calc(l - 1)));

    return 0;
}

/*
1 10 2
*/


#include <bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i = (a);i <= (b);++i)
typedef long long ll;
typedef pair<ll,ll> Point;
const int maxn = 1e5+5;
const int mod = 998244353;
ll qpow(ll a,ll b){ll res = 1;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int num[20];
ll dp[20][1<<11][2],f[20][1<<11][2];

ll l,r,k;
int pos;
Point dfs(int now,int sta,bool limit){

    if(now==-1){
        return make_pair(1,0);
    }
    ll &tmp = dp[now][sta][limit];
    ll &tmp2 = f[now][sta][limit];
    if(tmp!=-1)return make_pair(tmp,tmp2);
    tmp = 0,tmp2 = 0;
    int up = limit?num[now]:9;
    for(int i = 0;i <= up;++i){
        int st = (sta|(1<<i));
        //cout<<st<<' '<<__builtin_popcountll(st)<<endl;
        if(__builtin_popcountll(st)>k)continue;
        Point res = dfs(now-1,st,limit&&i==up);
        tmp = (tmp+res.first)%mod;
        tmp2 = (tmp2+res.second+qpow(10,now)*i%mod*res.first%mod)%mod;
    }
    return make_pair(tmp,tmp2);
}
ll solve(ll x)
{
    memset(dp,-1,sizeof(dp));
    memset(f,-1,sizeof(f));
    pos = 0;
    while(x){
        num[pos++] = x%10;
        x /= 10;
    }
    return dfs(pos-1,0,1).second;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("simple.in","r",stdin);
    freopen("simple.out","w",stdout);
#endif
    memset(dp,-1,sizeof(dp));
    cin>>l>>r>>k;
    printf("%lld\n",(solve(r)-solve(l-1)+mod)%mod);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i = (a);i <= (b);++i)
typedef long long ll;
typedef pair<ll,ll> Point;
const int maxn = 1e5+5;
const int mod = 998244353;
ll qpow(ll a,ll b){ll res = 1;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int num[20];
ll dp[20][1<<11][2],f[20][1<<11][2];

ll l,r,k;
int pos;
Point dfs(int now,int sta,bool limit){

    if(now==-1){
        return make_pair(1,0);
    }
    ll &tmp = dp[now][sta][limit];
    ll &tmp2 = f[now][sta][limit];
    if(tmp!=-1)return make_pair(tmp,tmp2);
    tmp = 0,tmp2 = 0;
    int up = limit?num[now]:9;
    for(int i = 0;i <= up;++i){
        int st = (sta|(1<<i));
        //cout<<st<<' '<<__builtin_popcountll(st)<<endl;
        if(__builtin_popcountll(st)>k)continue;
        Point res = dfs(now-1,st,limit&&i==up);
        tmp = (tmp+res.first)%mod;
        tmp2 = (tmp2+res.second+qpow(10,now)*i%mod*res.first%mod)%mod;
    }
    return make_pair(tmp,tmp2);
}
ll solve(ll x)
{
    memset(dp,-1,sizeof(dp));
    memset(f,-1,sizeof(f));
    pos = 0;
    while(x){
        num[pos++] = x%10;
        x /= 10;
    }
    return dfs(pos-1,0,1).second;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("simple.in","r",stdin);
    freopen("simple.out","w",stdout);
#endif
    memset(dp,-1,sizeof(dp));
    cin>>l>>r>>k;
    printf("%lld\n",solve(r)-solve(l-1));
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i = (a);i <= (b);++i)
typedef long long ll;
typedef pair<ll,ll> Point;
const int maxn = 1e5+5;
const int mod = 998244353;
ll qpow(ll a,ll b){ll res = 1;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int num[20];
ll dp[20][1<<12][2][2],f[20][1<<12][2][2];
ll l,r,k;
int pos;
Point dfs(int now,int sta,bool limit,bool zero){
    if(now==-1){
        return make_pair(1,0);
    }
    ll &tmp = dp[now][sta][limit][zero];
    ll &tmp2 = f[now][sta][limit][zero];
    if(tmp!=-1)return make_pair(tmp,tmp2);
    tmp = 0,tmp2 = 0;
    int up = limit?num[now]:9;
    for(int i = 0;i <= up;++i){
        int st;
        st = sta|((!zero||i)<<i);
        //cout<<st<<' '<<__builtin_popcountll(st)<<endl;
        if(__builtin_popcountll(st)>k)continue;
        Point res = dfs(now-1,st,limit&&i==up,zero&&i==0);
        tmp = (tmp+res.first)%mod;
        tmp2 = (tmp2+res.second+1ll*i*qpow(10,now)%mod*res.first%mod)%mod;
    }
    return make_pair(tmp,tmp2);
}
ll solve(ll x)
{
    memset(dp,-1,sizeof(dp));

    pos = 0;
    while(x){
        num[pos++] = x%10;
        x /= 10;
    }
    return dfs(pos-1,0,1,1).second;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("simple.in","r",stdin);
    freopen("simple.out","w",stdout);
#endif

    cin>>l>>r>>k;
    printf("%lld\n",(solve(r)-solve(l-1)+mod)%mod);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=998244353;
ll L,R;
int k;
int len,a[20];
ll f[20][2][2][1050],g[20][2][2][1050];
ll p[19];
ll dp(int i,int less,int have0,int sta){
	if(f[i][less][have0][sta]==-1||g[i][less][have0][sta]==-1){
		if(i==0){
			f[i][less][have0][sta]=0;
			if(sta==0) g[i][less][have0][sta]=1;
			else g[i][less][have0][sta]=0;
		}
		else{
			g[i][less][have0][sta]=0;
			f[i][less][have0][sta]=0;
			int end=less?9:a[i];
			for(ll j=0;j<=end;j++){
				if(!((1<<j)&sta)&&(!have0||j!=0)) continue;
				if(!have0||have0&&j!=0){
					f[i][less][have0][sta]+=dp(i-1,less|(j<end),have0&(j==0),sta^(1<<j))+g[i-1][less|(j<end)][have0&(j==0)][sta^(1<<j)]*j*p[i-1];
					g[i][less][have0][sta]+=g[i-1][less|(j<end)][have0&(j==0)][sta^(1<<j)];
					f[i][less][have0][sta]%=mod;
					g[i][less][have0][sta]%=mod;
				}
				f[i][less][have0][sta]+=dp(i-1,less|(j<end),have0&(j==0),sta)+g[i-1][less|(j<end)][have0&(j==0)][sta]*j*p[i-1];
				g[i][less][have0][sta]+=g[i-1][less|(j<end)][have0&(j==0)][sta];
				f[i][less][have0][sta]%=mod;
				g[i][less][have0][sta]%=mod;
			}
		}
	}
	return f[i][less][have0][sta];
}
int cal(int x){
	int ans=0;
	while(x) ans+=x&1,x>>=1;
	return ans;
}
ll sol(ll x){
	memset(a,0,sizeof(a));
	len=0;
	while(x>0){
		a[++len]=x%10;
		x/=10;
	}
	memset(f,-1,sizeof(f));
	memset(g,-1,sizeof(g));
	ll ans=0;
	for(int i=1;i<=(1<<10)-1;i++){
		if(cal(i)<=k) ans+=dp(len,0,1,i),ans%=mod /*cout<<ans<<endl*/;
	}
//	cout<<ans<<endl;
	return ans;
}
int main(){
	p[0]=1;
	for(int i=1;i<=18;i++) p[i]=p[i-1]*10ll;
	cin>>L>>R>>k;
	cout<<(sol(R)-sol(L-1)+mod)%mod<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=998244353;
ll L,R;
int k;
int len,a[20];
ll f[20][2][2][1050],g[20][2][2][1050];
ll p[19];
ll dp(int i,int less,int have0,int sta){
	if(f[i][less][have0][sta]==-1||g[i][less][have0][sta]==-1){
		if(i==0){
			f[i][less][have0][sta]=0;
			if(sta==0) g[i][less][have0][sta]=1;
			else g[i][less][have0][sta]=0;
		}
		else{
			g[i][less][have0][sta]=0;
			f[i][less][have0][sta]=0;
			int end=less?9:a[i];
			for(ll j=0;j<=end;j++){
				if(!((1<<j)&sta)&&(!have0||j!=0)) continue;
				if(!have0||have0&&j!=0){
					f[i][less][have0][sta]+=(dp(i-1,less|(j<end),have0&(j==0),sta^(1<<j))%mod+(((((g[i-1][less|(j<end)][have0&(j==0)][sta^(1<<j)]%mod)*j)%mod)*p[i-1])%mod))%mod;
					g[i][less][have0][sta]+=g[i-1][less|(j<end)][have0&(j==0)][sta^(1<<j)]%mod;
					f[i][less][have0][sta]%=mod;
					g[i][less][have0][sta]%=mod;
				}
				f[i][less][have0][sta]+=(dp(i-1,less|(j<end),have0&(j==0),sta)%mod+(((((g[i-1][less|(j<end)][have0&(j==0)][sta]%mod)*j)%mod)*p[i-1])%mod))%mod;
				g[i][less][have0][sta]+=g[i-1][less|(j<end)][have0&(j==0)][sta]%mod;
				f[i][less][have0][sta]%=mod;
				g[i][less][have0][sta]%=mod;
			}
		}
	}
//	if(f[i][less][have0][sta]<0) printf("**\n");
	return f[i][less][have0][sta]%mod;
}
int cal(int x){
	int ans=0;
	while(x) ans+=x&1,x>>=1;
	return ans;
}
ll sol(ll x){
	memset(a,0,sizeof(a));
	len=0;
	while(x>0){
		a[++len]=x%10;
		x/=10;
	}
	memset(f,-1,sizeof(f));
	memset(g,-1,sizeof(g));
	ll ans=0;
	for(int i=1;i<=(1<<10)-1;i++){
		if(cal(i)<=k) ans+=dp(len,0,1,i),ans%=mod /*cout<<ans<<endl*/;
	}
//	cout<<ans<<endl;
	return ans;
}
int main(){
	p[0]=1;
	for(int i=1;i<=18;i++) p[i]=p[i-1]*10ll%mod;
	cin>>L>>R>>k;
	cout<<(sol(R)-sol(L-1)+mod)%mod<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=998244353;
ll L,R;
int k;
int len,a[20];
ll f[20][2][2][1050],g[20][2][2][1050];
ll p[19];
ll dp(int i,int less,int have0,int sta){
	if(f[i][less][have0][sta]==-1||g[i][less][have0][sta]==-1){
		if(i==0){
			f[i][less][have0][sta]=0;
			if(sta==0) g[i][less][have0][sta]=1;
			else g[i][less][have0][sta]=0;
		}
		else{
			g[i][less][have0][sta]=0;
			f[i][less][have0][sta]=0;
			int end=less?9:a[i];
			for(ll j=0;j<=end;j++){
				if(!((1<<j)&sta)&&(!have0||j!=0)) continue;
				if(!have0||have0&&j!=0){
					f[i][less][have0][sta]+=dp(i-1,less|(j<end),have0&(j==0),sta^(1<<j))%mod+g[i-1][less|(j<end)][have0&(j==0)][sta^(1<<j)]*j*p[i-1]%mod;
					g[i][less][have0][sta]+=g[i-1][less|(j<end)][have0&(j==0)][sta^(1<<j)]%mod;
					f[i][less][have0][sta]%=mod;
					g[i][less][have0][sta]%=mod;
				}
				f[i][less][have0][sta]+=dp(i-1,less|(j<end),have0&(j==0),sta)%mod+g[i-1][less|(j<end)][have0&(j==0)][sta]*j*p[i-1]%mod;
				g[i][less][have0][sta]+=g[i-1][less|(j<end)][have0&(j==0)][sta]%mod;
				f[i][less][have0][sta]%=mod;
				g[i][less][have0][sta]%=mod;
			}
		}
	}
	return f[i][less][have0][sta];
}
int cal(int x){
	int ans=0;
	while(x) ans+=x&1,x>>=1;
	return ans;
}
ll sol(ll x){
	memset(a,0,sizeof(a));
	len=0;
	while(x>0){
		a[++len]=x%10;
		x/=10;
	}
	memset(f,-1,sizeof(f));
	memset(g,-1,sizeof(g));
	ll ans=0;
	for(int i=1;i<=(1<<10)-1;i++){
		if(cal(i)<=k) ans+=dp(len,0,1,i),ans%=mod /*cout<<ans<<endl*/;
	}
//	cout<<ans<<endl;
	return ans;
}
int main(){
	p[0]=1;
	for(int i=1;i<=18;i++) p[i]=p[i-1]*10ll;
	cin>>L>>R>>k;
	cout<<(sol(R)-sol(L-1)+mod)%mod<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll L,R;
int k;
int len,a[20];
ll f[20][2][2][1050],g[20][2][2][1050];
ll p[19];
ll dp(int i,int less,int have0,int sta){
	if(f[i][less][have0][sta]==-1||g[i][less][have0][sta]==-1){
		if(i==0){
			f[i][less][have0][sta]=0;
			if(sta==0) g[i][less][have0][sta]=1;
			else g[i][less][have0][sta]=0;
		}
		else{
			g[i][less][have0][sta]=0;
			f[i][less][have0][sta]=0;
			int end=less?9:a[i];
			for(ll j=0;j<=end;j++){
				if(!((1<<j)&sta)) continue;
				f[i][less][have0][sta]+=dp(i-1,less|(j<end),have0&(j==0),sta^(1<<j))+g[i-1][less|(j<end)][have0&(j==0)][sta^(1<<j)]*j*p[i-1];
				g[i][less][have0][sta]+=g[i-1][less|(j<end)][have0&(j==0)][sta^(1<<j)];
				f[i][less][have0][sta]+=dp(i-1,less|(j<end),have0&(j==0),sta)+g[i-1][less|(j<end)][have0&(j==0)][sta]*j*p[i-1];
				g[i][less][have0][sta]+=g[i-1][less|(j<end)][have0&(j==0)][sta];
			}
		}
	}
	return f[i][less][have0][sta];
}
int cal(int x){
	int ans=0;
	while(x) ans+=x&1,x>>=1;
	return ans;
}
ll sol(ll x){
	memset(a,0,sizeof(a));
	len=0;
	while(x>0){
		a[++len]=x%10;
		x/=10;
	}
	memset(f,-1,sizeof(f));
	memset(g,-1,sizeof(g));
	ll ans=0;
	for(int i=1;i<=(1<<10)-1;i++){
		if(cal(i)<=k) ans+=dp(len,0,1,i);
	}
	//cout<<ans<<endl;
	return ans;
}
int main(){
	p[0]=1;
	for(int i=1;i<=18;i++) p[i]=p[i-1]*10ll;
	cin>>L>>R>>k;
	cout<<sol(R)-sol(L-1)<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define pyshnapyshnakaa ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define pll pair <ll, ll>
#define MOMI using namespace std;
#pragma GCC optimize("O3")

MOMI;

typedef long long ll;

const ll maxn = 19;
const ll maxk = 10;
const ll maxst = 1024;
const ll mod = 998244353;

ll k;

//pll D[maxn][maxst]; /// = {sum, k-vo}; prefix, mask of digits(all < l);
pll D1[maxn][maxst]; /// = {sum, k-vo}; prefix, mask of digits(all);

ll st2[maxn];
ll st10[maxn];

bool M[maxst][maxk];
ll C[maxst];

bool M1[maxk];

bool M2[maxk];

ll solve(string l){
    if (l == ""){
        return 0;
    }
    ll q, w, e, t, y;
    ll n = l.length();
    ll ans = 0;
    ll 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++){
                    ll c = 0;
                    for (t = 0; t < maxk; t++){
                        M2[t] = M1[t] || M[w][t];
                        if (t == e && !(e == 0 && s == 0)){
                            M2[t] = 1;
                        }
                        c += M2[t];
                    }
                    //cout << c << endl;
                    if (c <= k){
                        //if (D1[y][w].second != 0)cout << y << " " << w << " " << q << " " << e << endl;
                        ans += (s + (e * st10[n - q - 1]) % mod)  * (D1[y][w].second % mod)  + D1[y][w].first;
                        ans %= mod;
                    }
                }
            }
        }
        M1[l[q] - '0'] = 1;
        s += (l[q] - '0') * st10[n - q - 1];
        s %= mod;
    }
    ll 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;
    }
    //c %= mod;
    //cout << ans << endl;
    //cout << "cnt " << cnt << " " << c << endl;
    if (cnt <= k){
        ans += c;
        ans %= mod;
    }
    //cout << ans << endl;
    return ans;
}

int main() {
    //pyshnapyshnakaa
    ll q, w, e, n, m;
    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++){
        ll q1 = q;
        ll c = maxst;
        ll i = 10;
        ll cnt = 0;
        while (c != 0){
            if (c <= q1){
                q1 -= c;
                M[q][i] = 1;
                cnt++;
            }
            i--;
            c /= 2;
        }
        C[q] = cnt;
    }
    //cout << "AMEN" << endl;
    ll L;
    cin >> L >> r >> k;
    L--;
    while (L != 0){
        l = (char)(L % 10 + '0') + l;
        L /= 10;
    }
    D1[0][0] = mp(0, 1);
    for (q = 0; q < maxn - 1; q++){
        for (w = 0; w < maxst; w++){
            for (e = 0; e < maxk; e++){
                ll nmsk;
                if (M[w][e]){
                    nmsk = w;
                }
                else{
                    nmsk = w + st2[e];
                }
                D1[q + 1][nmsk].first = (D1[q + 1][nmsk].first + D1[q][w].first * 10 + D1[q][w].second * e) % mod;
                D1[q + 1][nmsk].second = (D1[q + 1][nmsk].second + D1[q][w].second) % mod;
            }
        }
    }
    //cout << l << endl;
    //cout << "MOMI" << endl;
    cout << (solve(r) - solve(l) + mod) % mod;
    return 0;
}


#include <bits/stdc++.h>
#define pyshnapyshnakaa ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define pll pair <ll, ll>
#define MOMI using namespace std;
#pragma GCC optimize("O3")

MOMI;

typedef long long ll;

const ll maxn = 19;
const ll maxk = 10;
const ll maxst = 1024;
const ll mod = 998244353;

ll k;

//pll D[maxn][maxst]; /// = {sum, k-vo}; prefix, mask of digits(all < l);
pll D1[maxn][maxst]; /// = {sum, k-vo}; prefix, mask of digits(all);

ll st2[maxn];
ll st10[maxn];

bool M[maxst][maxk];
ll C[maxst];

bool M1[maxk];

bool M2[maxk];

ll solve(string l){
    ll q, w, e, t, y;
    ll n = l.length();
    ll ans = 0;
    ll 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++){
                    ll c = 0;
                    for (t = 0; t < maxk; t++){
                        M2[t] = M1[t] || M[w][t];
                        if (t == e){
                            M2[t] = 1;
                        }
                        c += M2[t];
                    }
                    //cout << c << endl;
                    if (c <= k){
                        //if (D1[y][w].second != 0)cout << y << " " << w << " " << q << " " << e << endl;
                        ans += (s + e * st10[n - q - 1]) * D1[y][w].second + D1[y][w].first;
                        ans %= mod;
                    }
                }
            }
        }
        M1[l[q] - '0'] = 1;
        s += (l[q] - '0') * st10[n - q - 1];
        s %= mod;
    }
    ll 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';
    }
    //cout << "cnt " << cnt << " " << c << endl;
    if (cnt <= k){
        ans += c;
        ans %= mod;
    }
    //cout << ans << endl;
    return ans;
}

int main() {
    //pyshnapyshnakaa
    ll q, w, e, n, m;
    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;
    }
    for (q = 0; q < maxst; q++){
        ll q1 = q;
        ll c = maxst;
        ll i = 10;
        ll cnt = 0;
        while (c != 0){
            if (c <= q1){
                q1 -= c;
                M[q][i] = 1;
                cnt++;
            }
            i--;
            c /= 2;
        }
        C[q] = cnt;
    }
    //cout << "AMEN" << endl;
    ll L;
    cin >> L >> r >> k;
    L--;
    while (L != 0){
        l = (char)(L % 10 + '0') + l;
        L /= 10;
    }
    D1[0][0] = mp(0, 1);
    for (q = 0; q < maxn - 1; q++){
        for (w = 0; w < maxst; w++){
            for (e = 0; e < maxk; e++){
                ll nmsk;
                if (M[w][e]){
                    nmsk = w;
                }
                else{
                    nmsk = w + st2[e];
                }
                D1[q + 1][nmsk].first = (D1[q + 1][nmsk].first + D1[q][w].first * 10 + D1[q][w].second * e) % mod;
                D1[q + 1][nmsk].second = D1[q + 1][nmsk].second + D1[q][w].second;
            }
        }
    }
    //cout << l << endl;
    //cout << "MOMI" << endl;
    cout << (solve(r) - solve(l) + mod) % mod;
    return 0;
}


#include <bits/stdc++.h>
#define pyshnapyshnakaa ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define pll pair <ll, ll>
#define MOMI using namespace std;
#pragma GCC optimize("O3")

MOMI;

typedef long long ll;

const ll maxn = 19;
const ll maxk = 10;
const ll maxst = 1024;
const ll mod = 998244353;

ll k;

//pll D[maxn][maxst]; /// = {sum, k-vo}; prefix, mask of digits(all < l);
pll D1[maxn][maxst]; /// = {sum, k-vo}; prefix, mask of digits(all);

ll st2[maxn];
ll st10[maxn];

bool M[maxst][maxk];
ll C[maxst];

bool M1[maxk];

bool M2[maxk];

ll solve(string l){
    if (l == ""){
        return 0;
    }
    ll q, w, e, t, y;
    ll n = l.length();
    ll ans = 0;
    ll 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++){
                    ll c = 0;
                    for (t = 0; t < maxk; t++){
                        M2[t] = M1[t] || M[w][t];
                        if (t == e && !(e == 0 && s == 0)){
                            M2[t] = 1;
                        }
                        c += M2[t];
                    }
                    //cout << c << endl;
                    if (c <= k){
                        //if (D1[y][w].second != 0)cout << y << " " << w << " " << q << " " << e << endl;
                        ans += (s + (e * st10[n - q - 1]) % mod)  * (D1[y][w].second % mod)  + D1[y][w].first;
                        ans %= mod;
                    }
                }
            }
        }
        M1[l[q] - '0'] = 1;
        s += (l[q] - '0') * st10[n - q - 1];
        s %= mod;
    }
    ll 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;
    }
    //c %= mod;
    //cout << ans << endl;
    //cout << "cnt " << cnt << " " << c << endl;
    if (cnt <= k){
        ans += c;
        ans %= mod;
    }
    //cout << ans << endl;
    return ans;
}

int main() {
    //pyshnapyshnakaa
    ll q, w, e, n, m;
    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++){
        ll q1 = q;
        ll c = maxst;
        ll i = 10;
        ll cnt = 0;
        while (c != 0){
            if (c <= q1){
                q1 -= c;
                M[q][i] = 1;
                cnt++;
            }
            i--;
            c /= 2;
        }
        C[q] = cnt;
    }
    //cout << "AMEN" << endl;
    ll L;
    cin >> L >> r >> k;
    L--;
    while (L != 0){
        l = (char)(L % 10 + '0') + l;
        L /= 10;
    }
    D1[0][0] = mp(0, 1);
    for (q = 0; q < maxn - 1; q++){
        for (w = 0; w < maxst; w++){
            for (e = 0; e < maxk; e++){
                ll nmsk;
                if (M[w][e]){
                    nmsk = w;
                }
                else{
                    nmsk = w + st2[e];
                }
                D1[q + 1][nmsk].first = (D1[q + 1][nmsk].first + D1[q][w].first * 10 + D1[q][w].second * e) % mod;
                D1[q + 1][nmsk].second = (D1[q + 1][nmsk].second + D1[q][w].second) % mod;
            }
        }
    }
    //cout << l << endl;
    //cout << "MOMI" << endl;
    cout << (solve(r) - solve(l) + 2 * mod) % mod;
    return 0;
}


#include <bits/stdc++.h>
#define pyshnapyshnakaa ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define pll pair <ll, ll>
#define MOMI using namespace std;
#pragma GCC optimize("O3")

MOMI;

typedef long long ll;

const ll maxn = 19;
const ll maxk = 10;
const ll maxst = 1024;
const ll mod = 998244353;

ll k;

//pll D[maxn][maxst]; /// = {sum, k-vo}; prefix, mask of digits(all < l);
pll D1[maxn][maxst]; /// = {sum, k-vo}; prefix, mask of digits(all);

ll st2[maxn];
ll st10[maxn];

bool M[maxst][maxk];
ll C[maxst];

bool M1[maxk];

bool M2[maxk];

ll solve(string l){
    if (l == ""){
        return 0;
    }
    ll q, w, e, t, y;
    ll n = l.length();
    ll ans = 0;
    ll 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++){
                    ll c = 0;
                    for (t = 0; t < maxk; t++){
                        M2[t] = M1[t] || M[w][t];
                        if (t == e){
                            M2[t] = 1;
                        }
                        c += M2[t];
                    }
                    //cout << c << endl;
                    if (c <= k){
                        //if (D1[y][w].second != 0)cout << y << " " << w << " " << q << " " << e << endl;
                        ans += (s + e * st10[n - q - 1]) * (D1[y][w].second % mod)  + D1[y][w].first;
                        ans %= mod;
                    }
                }
            }
        }
        M1[l[q] - '0'] = 1;
        s += (l[q] - '0') * st10[n - q - 1];
        s %= mod;
    }
    ll 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';
    }
    //cout << "cnt " << cnt << " " << c << endl;
    if (cnt <= k){
        ans += c;
        ans %= mod;
    }
    //cout << ans << endl;
    return ans;
}

int main() {
    //pyshnapyshnakaa
    ll q, w, e, n, m;
    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;
    }
    for (q = 0; q < maxst; q++){
        ll q1 = q;
        ll c = maxst;
        ll i = 10;
        ll cnt = 0;
        while (c != 0){
            if (c <= q1){
                q1 -= c;
                M[q][i] = 1;
                cnt++;
            }
            i--;
            c /= 2;
        }
        C[q] = cnt;
    }
    //cout << "AMEN" << endl;
    ll L;
    cin >> L >> r >> k;
    L--;
    while (L != 0){
        l = (char)(L % 10 + '0') + l;
        L /= 10;
    }
    D1[0][0] = mp(0, 1);
    for (q = 0; q < maxn - 1; q++){
        for (w = 0; w < maxst; w++){
            for (e = 0; e < maxk; e++){
                ll nmsk;
                if (M[w][e]){
                    nmsk = w;
                }
                else{
                    nmsk = w + st2[e];
                }
                D1[q + 1][nmsk].first = (D1[q + 1][nmsk].first + D1[q][w].first * 10 + D1[q][w].second * e) % mod;
                D1[q + 1][nmsk].second = (D1[q + 1][nmsk].second + D1[q][w].second) % mod;
            }
        }
    }
    //cout << l << endl;
    //cout << "MOMI" << endl;
    cout << (solve(r) - solve(l) + mod) % mod;
    return 0;
}


#include <bits/stdc++.h>
#define pyshnapyshnakaa ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define pll pair <ll, ll>
#define MOMI using namespace std;
#pragma GCC optimize("O3")

MOMI;

typedef long long ll;

const ll maxn = 19;
const ll maxk = 10;
const ll maxst = 1024;
const ll mod = 998244353;

ll k;

//pll D[maxn][maxst]; /// = {sum, k-vo}; prefix, mask of digits(all < l);
pll D1[maxn][maxst]; /// = {sum, k-vo}; prefix, mask of digits(all);

ll st2[maxn];
ll st10[maxn];

bool M[maxst][maxk];
ll C[maxst];

bool M1[maxk];

bool M2[maxk];

ll solve(string l){
    if (l == ""){
        return 0;
    }
    ll q, w, e, t, y;
    ll n = l.length();
    ll ans = 0;
    ll 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++){
                    ll c = 0;
                    for (t = 0; t < maxk; t++){
                        M2[t] = M1[t] || M[w][t];
                        if (t == e){
                            M2[t] = 1;
                        }
                        c += M2[t];
                    }
                    //cout << c << endl;
                    if (c <= k){
                        //if (D1[y][w].second != 0)cout << y << " " << w << " " << q << " " << e << endl;
                        ans += (s + (e * st10[n - q - 1]) % mod)  * (D1[y][w].second % mod)  + D1[y][w].first;
                        ans %= mod;
                    }
                }
            }
        }
        M1[l[q] - '0'] = 1;
        s += (l[q] - '0') * st10[n - q - 1];
        s %= mod;
    }
    ll 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';
    }
    //cout << "cnt " << cnt << " " << c << endl;
    if (cnt <= k){
        ans += c;
        ans %= mod;
    }
    //cout << ans << endl;
    return ans;
}

int main() {
    //pyshnapyshnakaa
    ll q, w, e, n, m;
    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;
    }
    for (q = 0; q < maxst; q++){
        ll q1 = q;
        ll c = maxst;
        ll i = 10;
        ll cnt = 0;
        while (c != 0){
            if (c <= q1){
                q1 -= c;
                M[q][i] = 1;
                cnt++;
            }
            i--;
            c /= 2;
        }
        C[q] = cnt;
    }
    //cout << "AMEN" << endl;
    ll L;
    cin >> L >> r >> k;
    L--;
    while (L != 0){
        l = (char)(L % 10 + '0') + l;
        L /= 10;
    }
    D1[0][0] = mp(0, 1);
    for (q = 0; q < maxn - 1; q++){
        for (w = 0; w < maxst; w++){
            for (e = 0; e < maxk; e++){
                ll nmsk;
                if (M[w][e]){
                    nmsk = w;
                }
                else{
                    nmsk = w + st2[e];
                }
                D1[q + 1][nmsk].first = (D1[q + 1][nmsk].first + D1[q][w].first * 10 + D1[q][w].second * e) % mod;
                D1[q + 1][nmsk].second = (D1[q + 1][nmsk].second + D1[q][w].second) % mod;
            }
        }
    }
    //cout << l << endl;
    //cout << "MOMI" << endl;
    cout << (solve(r) - solve(l) + mod) % mod;
    return 0;
}


#include <bits/stdc++.h>
#define pyshnapyshnakaa ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define pll pair <ll, ll>
#define MOMI using namespace std;
#pragma GCC optimize("O3")

MOMI;

typedef long long ll;

const ll maxn = 19;
const ll maxk = 10;
const ll maxst = 1024;
const ll mod = 998244353;

ll k;

//pll D[maxn][maxst]; /// = {sum, k-vo}; prefix, mask of digits(all < l);
pll D1[maxn][maxst][2]; /// = {sum, k-vo}; prefix, mask of digits(all), bool = existance of leading zeroes

ll st2[maxn];
ll st10[maxn];

bool M[maxst][maxk];
ll C[maxst];

bool M1[maxk];

bool M2[maxk];

ll solve(string l){
    if (l == ""){
        return 0;
    }
    ll q, w, e, t, y;
    ll n = l.length();
    ll ans = 0;
    ll 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++){
                    ll 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];
                    }
                    //cout << c << endl;
                    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){
                        //if (D1[y][w].second != 0)cout << y << " " << w << " " << q << " " << e << endl;
                        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;
    }
    ll 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;
    }
    //c %= mod;
    //cout << ans << endl;
    //cout << "cnt " << cnt << " " << c << endl;
    if (cnt <= k){
        ans += c;
        ans %= mod;
    }
    //cout << ans << endl;
    return ans;
}

int main() {
    //pyshnapyshnakaa
    ll 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++){
        ll q1 = q;
        ll c = maxst;
        ll i = 10;
        ll cnt = 0;
        while (c != 0){
            if (c <= q1){
                q1 -= c;
                M[q][i] = 1;
                cnt++;
            }
            i--;
            c /= 2;
        }
        C[q] = cnt;
    }
    //cout << "AMEN" << endl;
    ll L;
    cin >> L >> r >> k;
    L--;
    while (L != 0){
        l = (char)(L % 10 + '0') + l;
        L /= 10;
    }
    D1[0][0][0] = mp(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++){
                    ll nmsk;
                    ll 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 << l << endl;
    //cout << "MOMI" << endl;
    cout << (solve(r) - solve(l) + 2 * mod) % mod;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define N 200005
typedef long long ll;
ll MOD = 998244353;
string c;
string a, b;
int K;
ll power[N];
ll memo[1024][19][19][2];
ll memo1[1024][19][19][2];
ll calcMemo(ll mask, int idx, int rem, bool isSmaller, int k) {
    if (rem == 0) {

        int cnt = 0;
        for(int j=0; j<10; j++) if (mask & (1 << j)) cnt++;
        if (cnt <= k) return 1;
        return 0;
    }

    ll &ret = memo[mask][idx][rem][isSmaller];
    if (ret != -1) return ret;

    ret = 0;
    int to = (isSmaller) ? 9 : c[idx] - '0';
    for(int i=0; i<=to; i++) {
        ret += calcMemo(mask | (1 << i), idx + 1, rem - 1, isSmaller | (i <= (c[idx] - '0')), k);
    }

    ret %= MOD;
    return ret;

}

ll calcMemo1(ll mask, int idx, int rem, bool is) {
    if (rem == 0) {
        return 0;
    }
    ll &ret = memo1[mask][idx][rem][is];
    if (ret != -1) return ret;

    ret = 0;
    int start = 0; if (idx == 0) start = 1;
    int endd = 9; if (!is) endd = c[idx] - '0';
    for(int i=start; i<=endd; i++) {
        int newMask = mask | (1 << i);
        if (__builtin_popcount(newMask) > K) continue;
        ret += calcMemo1(mask | (1 << i), idx + 1, rem - 1, is | (i < (c[idx] - '0')));
        ret += calcMemo(mask | (1 << i), idx + 1, rem - 1,  is | (i < (c[idx] - '0')), K) * ((power[rem - 1] * (i))%MOD);
        ret %= MOD;
    }
    return ret;
}

string convertToString(ll x) {
    if (x == 0) {
        return "0";
    }
    string ret = "";

    while(x) {
      ret +=   (x % 10) + '0';
      x /= 10;
    }
    reverse(ret.begin(), ret.end());
    return ret;
}

ll solve(string x) {
    c = x;

    memset(memo, -1, sizeof memo);
    memset(memo1, -1, sizeof memo1);
    ll ret = 0;
    for(int i=1; i<c.size(); i++) {
             memset(memo, -1, sizeof memo);
    memset(memo1, -1, sizeof memo1);
        ret += calcMemo1(0, 0, i, true);

        ret %= MOD;

    }
 memset(memo, -1, sizeof memo);
    memset(memo1, -1, sizeof memo1);
    ret += calcMemo1(0, 0, c.size(), false);
    return ret % MOD;

}
int main()
{
    ios::sync_with_stdio(0);

    power[0] = 1;
    for(int i=1; i<=20;i++) power[i] = (power[i - 1] * 10) % MOD;

    ll f;
    cin >> f;
    ll f2; cin >> f2;
    b = f2;
    cin  >> K;
    f--;

    if (K >= b.size()) {
        ll x1 = f2 * (f2 - 1) / 2;
        ll x2 = f1 * (f1 - 1) / 2;
        ll ans = x1 - x2; ans %= MOD; ans += MOD; ans %= MOD;
        cout <<ans << endl;
        return 0;
    }

    a = convertToString(f);

  //  a = "11";
  //  cout << solve(a) << endl;

    ll ans = solve(b) - solve(a);
    ans = ans + MOD; ans %= MOD;
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define N 200005
typedef long long ll;
ll MOD = 998244353;
string c;
string a, b;
int K;
ll power[N];
ll memo[1024][19][19][2];
ll memo1[1024][19][19][2];
ll calcMemo(ll mask, int idx, int rem, bool isSmaller, int k) {
    if (rem == 0) {

        int cnt = 0;
        for(int j=0; j<10; j++) if (mask & (1 << j)) cnt++;
        if (cnt <= k) return 1;
        return 0;
    }

    ll &ret = memo[mask][idx][rem][isSmaller];
    if (ret != -1) return ret;

    ret = 0;
    int to = (isSmaller) ? 9 : c[idx] - '0';
    for(int i=0; i<=to; i++) {
        ret += calcMemo(mask | (1 << i), idx + 1, rem - 1, isSmaller | (i <= (c[idx] - '0')), k);
    }

    ret %= MOD;
    return ret;

}

ll calcMemo1(ll mask, int idx, int rem, bool is) {
    if (rem == 0) {
        return 0;
    }
    ll &ret = memo1[mask][idx][rem][is];
    if (ret != -1) return ret;

    ret = 0;
    int start = 0; if (idx == 0) start = 1;
    int endd = 9; if (!is) endd = c[idx] - '0';
    for(int i=start; i<=endd; i++) {
        int newMask = mask | (1 << i);
        if (__builtin_popcount(newMask) > K) continue;
        ret += calcMemo1(mask | (1 << i), idx + 1, rem - 1, is | (i < (c[idx] - '0')));
        ret += calcMemo(mask | (1 << i), idx + 1, rem - 1,  is | (i < (c[idx] - '0')), K) * ((power[rem - 1] * (i))%MOD);
        ret %= MOD;
    }
    return ret;
}

string convertToString(ll x) {
    if (x == 0) {
        return "0";
    }
    string ret = "";

    while(x) {
      ret +=   (x % 10) + '0';
      x /= 10;
    }
    reverse(ret.begin(), ret.end());
    return ret;
}

ll solve(string x) {
    c = x;

    memset(memo, -1, sizeof memo);
    memset(memo1, -1, sizeof memo1);
    ll ret = 0;
    for(int i=1; i<c.size(); i++) {
             memset(memo, -1, sizeof memo);
    memset(memo1, -1, sizeof memo1);
        ret += calcMemo1(0, 0, i, true);

        ret %= MOD;

    }
 memset(memo, -1, sizeof memo);
    memset(memo1, -1, sizeof memo1);
    ret += calcMemo1(0, 0, c.size(), false);
    return ret % MOD;

}
int main()
{
    ios::sync_with_stdio(0);

    power[0] = 1;
    for(int i=1; i<=20;i++) power[i] = (power[i - 1] * 10) % MOD;

    ll f;
    cin >> f;
    ll f2; cin >> f2;
    b = convertToString(f2);
    cin  >> K;
    f--;

    if (K >= b.size()) {
        ll x1 = f2 * (f2 + 1) / 2;
        ll x2 = f * (f + 1) / 2;
        ll ans = x1 - x2; ans %= MOD; ans += MOD; ans %= MOD;
        cout <<ans << endl;
        return 0;
    }

    a = convertToString(f);

  //  a = "11";
  //  cout << solve(a) << endl;

    ll ans = solve(b) - solve(a);
    ans = ans + MOD; ans %= MOD;
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define N 200005
typedef long long ll;
ll MOD = 998244353;
string c;
string a, b;
int K;
ll power[N];
ll memo[1024][19][19][2];
ll memo1[1024][19][19][2];
ll calcMemo(ll mask, int idx, int rem, bool isSmaller, int k) {
    if (rem == 0) {

        int cnt = 0;
        for(int j=0; j<10; j++) if (mask & (1 << j)) cnt++;
        if (cnt <= k) return 1;
        return 0;
    }

    ll &ret = memo[mask][idx][rem][isSmaller];
    if (ret != -1) return ret;

    ret = 0;
    int to = (isSmaller) ? 9 : c[idx] - '0';
    for(int i=0; i<=to; i++) {
        ret += calcMemo(mask | (1 << i), idx + 1, rem - 1, isSmaller | (i <= (c[idx] - '0')), k);
    }

    ret %= MOD;
    return ret;

}

ll calcMemo1(ll mask, int idx, int rem, bool is) {
    if (rem == 0) {
        return 0;
    }
    ll &ret = memo1[mask][idx][rem][is];
    if (ret != -1) return ret;

    ret = 0;
    int start = 0; if (idx == 0) start = 1;
    int endd = 9; if (!is) endd = c[idx] - '0';
    for(int i=start; i<=endd; i++) {
        int newMask = mask | (1 << i);
        if (__builtin_popcount(newMask) > K) continue;
        ret += calcMemo1(mask | (1 << i), idx + 1, rem - 1, is | (i < (c[idx] - '0')));
        ret += calcMemo(mask | (1 << i), idx + 1, rem - 1,  is | (i < (c[idx] - '0')), K) * ((power[rem - 1] * (i))%MOD);
        ret %= MOD;
    }
    return ret;
}

string convertToString(ll x) {
    if (x == 0) {
        return "0";
    }
    string ret = "";

    while(x) {
      ret +=   (x % 10) + '0';
      x /= 10;
    }
    reverse(ret.begin(), ret.end());
    return ret;
}

ll solve(string x) {
    c = x;

    memset(memo, -1, sizeof memo);
    memset(memo1, -1, sizeof memo1);
    ll ret = 0;
    for(int i=1; i<c.size(); i++) {
             memset(memo, -1, sizeof memo);
    memset(memo1, -1, sizeof memo1);
        ret += calcMemo1(0, 0, i, true);

        ret %= MOD;

    }
 memset(memo, -1, sizeof memo);
    memset(memo1, -1, sizeof memo1);
    ret += calcMemo1(0, 0, c.size(), false);
    return ret % MOD;

}
int main()
{
    ios::sync_with_stdio(0);

    power[0] = 1;
    for(int i=1; i<=20;i++) power[i] = (power[i - 1] * 10) % MOD;

    ll f;
    cin >> f;
    ll f2; cin >> f2;
    b = f2;
    cin  >> K;
    f--;

    if (K >= b.size()) {
        ll x1 = f2 * (f2 - 1) / 2;
        ll x2 = f * (f - 1) / 2;
        ll ans = x1 - x2; ans %= MOD; ans += MOD; ans %= MOD;
        cout <<ans << endl;
        return 0;
    }

    a = convertToString(f);

  //  a = "11";
  //  cout << solve(a) << endl;

    ll ans = solve(b) - solve(a);
    ans = ans + MOD; ans %= MOD;
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define N 200005
typedef long long ll;
ll MOD = 998244353;
string c;
string a, b;
int K;
ll power[N];
ll memo[1024][19][19][2];
ll memo1[1024][19][19][2];
ll calcMemo(ll mask, int idx, int rem, bool isSmaller, int k) {
    if (rem == 0) {
        int cnt = 0;
        for(int j=0; j<10; j++) if (mask & (1 << j)) cnt++;
        if (cnt <= k) return 1;
        return 0;
    }

    ll &ret = memo[mask][idx][rem][isSmaller];
    if (ret != -1) return ret;

    ret = 0;
    int start = 0; if (idx == 0) start = 1;
    int endd = 9; if (!isSmaller) endd = c[idx] - '0';
    for(int i=start; i<=endd; i++) {
        ret += calcMemo(mask | (1 << i), idx + 1, rem - 1, isSmaller | (i < (c[idx] - '0')), k);
    }

    ret %= MOD;
    return ret;

}

ll calcMemo1(ll mask, int idx, int rem, bool is) {
    if (rem == 0) {
        return 0;
    }
    ll &ret = memo1[mask][idx][rem][is];
    if (ret != -1) return ret;

    ret = 0;
    int start = 0; if (idx == 0) start = 1;
    int endd = 9; if (!is) endd = c[idx] - '0';
    for(int i=start; i<=endd; i++) {
        int newMask = mask | (1 << i);
        if (__builtin_popcount(newMask) > K) continue;
        ret += calcMemo1(mask | (1 << i), idx + 1, rem - 1, is | (i < (c[idx] - '0')));
        ret += calcMemo(mask | (1 << i), idx + 1, rem - 1,  is | (i < (c[idx] - '0')), K) * ((power[rem - 1] * (i))%MOD);
        ret %= MOD;
    }
    return ret;
}

string convertToString(ll x) {
    if (x == 0) {
        return "0";
    }
    string ret = "";

    while(x) {
      ret +=   (x % 10) + '0';
      x /= 10;
    }
    reverse(ret.begin(), ret.end());
    return ret;
}

ll solve(string x) {
    c = x;

    memset(memo, -1, sizeof memo);
    memset(memo1, -1, sizeof memo1);
    ll ret = 0;
    for(int i=1; i<c.size(); i++) {
        ret += calcMemo1(0, 0, i, true);
        ret %= MOD;

    }

    ret += calcMemo1(0, 0, c.size(), false);
    return ret % MOD;

}
int main()
{
    ios::sync_with_stdio(0);

    power[0] = 1;
    for(int i=1; i<=20;i++) power[i] = (power[i - 1] * 10) % MOD;

    ll f;
    cin >> f;
    cin >> b >> K;
    f--;

    a = convertToString(f);

  //  a = "11";
  //  cout << solve(a) << endl;
   // c="100";

    ll ans = solve(b) - solve(a);
    ans = ans + MOD; ans %= MOD;
    cout << ans << endl;
    return 0;
}


/* code by Pranjal Rai */
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll M=998244353;
ll inf=2e18;
string to_string1(ll x){stringstream ss; ss<<x; return ss.str();}
ll to_integer(string s){stringstream ss(s); ll x; ss>>x; return x;}

ll l,r,k,p[20];
pair<ll,ll> dp[20][1025][2][2];
string s;

pair<ll,ll> fun(ll i, ll mask, ll tight, ll zero)
{
    if(i==s.size())
    {
        return {1,0};
    }
    pair<ll,ll> pr={-1,-1};
    if(dp[i][mask][tight][zero]!=pr)
        return dp[i][mask][tight][zero];
    ll lim=9;
    if(tight)
        lim=s[i]-'0';
    pair<ll,ll> ans={0,0};
    ll val=0,cnt=0;
    //cout<<"situation "<<i<<" "<<tight<<" "<<lim<<"\n";
    for(ll j=0;j<=lim;j++)
    {
        ll temp=(mask|(1<<j));
        ll setbit=__builtin_popcount(temp);
        if(setbit>k)
            continue;
        if(zero && j==0)
        {
            ans=fun(i+1,0,0,1);
            cnt=(cnt+ans.ff)%M;
            val=(val+(ans.ff*(j*p[s.size()-i-1])%M)%M)%M;
            val=(val+ans.ss)%M;
            //cout<<"\n i and j "<<i<<" "<<j<<"\n";
            //cout<<ans.ff<<" see "<<ans.ss<<"\n";
            //cout<<(ans.ff*j*p[s.size()-i-1])<<" add hua "<<ans.ss<<" age se aya\n";
            continue;
        }
        if(j==lim && tight)
        {
            ans=fun(i+1,temp,1,0);
            cnt=(cnt+ans.ff)%M;
            val=(val+(ans.ff*(j*p[s.size()-i-1])%M)%M)%M;
            val=(val+ans.ss)%M;
            //cout<<"\n i and j "<<i<<" "<<j<<"\n";
            //cout<<ans.ff<<" see "<<ans.ss<<"\n";
            //cout<<(ans.ff*j*p[s.size()-i-1])<<" add hua "<<ans.ss<<" age se aya\n";
            continue;
        }
        ans=fun(i+1,temp,0,0);
        cnt=(cnt+ans.ff)%M;
        val=(val+(ans.ff*(j*p[s.size()-i-1])%M)%M)%M;
        val=(val+ans.ss)%M;
        //cout<<"\n i and j "<<i<<" "<<j<<"\n";
        //cout<<ans.ff<<" see "<<ans.ss<<"\n";
        //cout<<(ans.ff*j*p[s.size()-i-1])<<" add hua "<<ans.ss<<" age se aya\n";
    }
    return dp[i][mask][tight][zero]={cnt,val};
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    p[0]=1;
    for(ll i=1;i<=18;i++)
        p[i]=(p[i-1]*10LL)%M;
    cin>>l>>r>>k;
    l--;
    s=to_string1(l);
    memset(dp,-1,sizeof dp);
    pair<ll,ll> val1=fun(0,0,1,1);
    memset(dp,-1,sizeof dp);
    s=to_string1(r);
    pair<ll,ll> val2=fun(0,0,1,1);
    //cout<<val1.ff<<" "<<val1.ss<<" "<<val2.ff<<" "<<val2.ss<<"\n";
    cout<<(val2.ss-val1.ss+M)%M<<"\n";
    return 0;
}


/* code by Pranjal Rai */
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll M=998244353;
ll inf=2e18;
string to_string(ll x){stringstream ss; ss<<x; return ss.str();}
ll to_integer(string s){stringstream ss(s); ll x; ss>>x; return x;}

ll l,r,k,p[20];
pair<ll,ll> dp[20][1025][2];
string s;

pair<ll,ll> fun(ll i, ll mask, ll tight)
{
    if(i==s.size())
    {
        return {1,0};
    }
    pair<ll,ll> pr={-1,-1};
    if(dp[i][mask][tight]!=pr)
        return dp[i][mask][tight];
    ll lim=9;
    if(tight)
        lim=s[i]-'0';
    pair<ll,ll> ans={0,0};
    ll val=0,cnt=0;
    //cout<<"situation "<<i<<" "<<tight<<" "<<lim<<"\n";
    for(ll j=0;j<=lim;j++)
    {
        ll temp=(mask|(1<<j));
        ll setbit=__builtin_popcount(temp);
        if(setbit>k)
            continue;
        if(i==0 && j==0)
        {
            ans=fun(i+1,mask,0);
            cnt=(cnt+ans.ff)%M;
            val=(val+(ans.ff*(j*p[s.size()-i-1])%M)%M)%M;
            val=(val+ans.ss)%M;
            //cout<<"\n i and j "<<i<<" "<<j<<"\n";
            //cout<<ans.ff<<" see "<<ans.ss<<"\n";
            //cout<<(ans.ff*j*p[s.size()-i-1])<<" add hua "<<ans.ss<<" age se aya\n";
            continue;
        }
        if(j==lim && tight)
        {
            ans=fun(i+1,temp,1);
            cnt=(cnt+ans.ff)%M;
            val=(val+(ans.ff*(j*p[s.size()-i-1])%M)%M)%M;
            val=(val+ans.ss)%M;
            //cout<<"\n i and j "<<i<<" "<<j<<"\n";
            //cout<<ans.ff<<" see "<<ans.ss<<"\n";
            //cout<<(ans.ff*j*p[s.size()-i-1])<<" add hua "<<ans.ss<<" age se aya\n";
            continue;
        }
        ans=fun(i+1,temp,0);
        cnt=(cnt+ans.ff)%M;
        val=(val+(ans.ff*(j*p[s.size()-i-1])%M)%M)%M;
        val=(val+ans.ss)%M;
        //cout<<"\n i and j "<<i<<" "<<j<<"\n";
        //cout<<ans.ff<<" see "<<ans.ss<<"\n";
        //cout<<(ans.ff*j*p[s.size()-i-1])<<" add hua "<<ans.ss<<" age se aya\n";
    }
    return dp[i][mask][tight]={cnt,val};
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    p[0]=1;
    for(ll i=1;i<=18;i++)
        p[i]=(p[i-1]*10LL)%M;
    cin>>l>>r>>k;
    l--;
    s=to_string(l);
    memset(dp,-1,sizeof dp);
    pair<ll,ll> val1=fun(0,0,1);
    memset(dp,-1,sizeof dp);
    s=to_string(r);
    pair<ll,ll> val2=fun(0,0,1);
    //cout<<val1.ff<<" "<<val1.ss<<" "<<val2.ff<<" "<<val2.ss<<"\n";
    cout<<(val2.ss-val1.ss+M)%M<<"\n";
    return 0;
}


/* code by Pranjal Rai */
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll M=998244353;
ll inf=2e18;
string to_string1(ll x){stringstream ss; ss<<x; return ss.str();}
ll to_integer(string s){stringstream ss(s); ll x; ss>>x; return x;}

ll l,r,k,p[20];
pair<ll,ll> dp[20][1025][2];
string s;

pair<ll,ll> fun(ll i, ll mask, ll tight)
{
    if(i==s.size())
    {
        return {1,0};
    }
    pair<ll,ll> pr={-1,-1};
    if(dp[i][mask][tight]!=pr)
        return dp[i][mask][tight];
    ll lim=9;
    if(tight)
        lim=s[i]-'0';
    pair<ll,ll> ans={0,0};
    ll val=0,cnt=0;
    //cout<<"situation "<<i<<" "<<tight<<" "<<lim<<"\n";
    for(ll j=0;j<=lim;j++)
    {
        ll temp=(mask|(1<<j));
        ll setbit=__builtin_popcount(temp);
        if(setbit>k)
            continue;
        if(i==0 && j==0)
        {
            ans=fun(i+1,mask,0);
            cnt=(cnt+ans.ff)%M;
            val=(val+(ans.ff*(j*p[s.size()-i-1])%M)%M)%M;
            val=(val+ans.ss)%M;
            //cout<<"\n i and j "<<i<<" "<<j<<"\n";
            //cout<<ans.ff<<" see "<<ans.ss<<"\n";
            //cout<<(ans.ff*j*p[s.size()-i-1])<<" add hua "<<ans.ss<<" age se aya\n";
            continue;
        }
        if(j==lim && tight)
        {
            ans=fun(i+1,temp,1);
            cnt=(cnt+ans.ff)%M;
            val=(val+(ans.ff*(j*p[s.size()-i-1])%M)%M)%M;
            val=(val+ans.ss)%M;
            //cout<<"\n i and j "<<i<<" "<<j<<"\n";
            //cout<<ans.ff<<" see "<<ans.ss<<"\n";
            //cout<<(ans.ff*j*p[s.size()-i-1])<<" add hua "<<ans.ss<<" age se aya\n";
            continue;
        }
        ans=fun(i+1,temp,0);
        cnt=(cnt+ans.ff)%M;
        val=(val+(ans.ff*(j*p[s.size()-i-1])%M)%M)%M;
        val=(val+ans.ss)%M;
        //cout<<"\n i and j "<<i<<" "<<j<<"\n";
        //cout<<ans.ff<<" see "<<ans.ss<<"\n";
        //cout<<(ans.ff*j*p[s.size()-i-1])<<" add hua "<<ans.ss<<" age se aya\n";
    }
    return dp[i][mask][tight]={cnt,val};
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    p[0]=1;
    for(ll i=1;i<=18;i++)
        p[i]=(p[i-1]*10LL)%M;
    cin>>l>>r>>k;
    l--;
    s=to_string1(l);
    memset(dp,-1,sizeof dp);
    pair<ll,ll> val1=fun(0,0,1);
    memset(dp,-1,sizeof dp);
    s=to_string1(r);
    pair<ll,ll> val2=fun(0,0,1);
    //cout<<val1.ff<<" "<<val1.ss<<" "<<val2.ff<<" "<<val2.ss<<"\n";
    cout<<(val2.ss-val1.ss+M)%M<<"\n";
    return 0;
}


/* code by Pranjal Rai */
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll M=998244353;
ll inf=2e18;
string to_string1(ll x){stringstream ss; ss<<x; return ss.str();}
ll to_integer(string s){stringstream ss(s); ll x; ss>>x; return x;}

ll l,r,k,p[20];
pair<ll,ll> dp[20][1025][2][2];
string s;

pair<ll,ll> fun(ll i, ll mask, ll tight, ll zero)
{
    if(i==s.size())
    {
        return {1,0};
    }
    pair<ll,ll> pr={-1,-1};
    if(dp[i][mask][tight][zero]!=pr)
        return dp[i][mask][tight][zero];
    ll lim=9;
    if(tight)
        lim=s[i]-'0';
    pair<ll,ll> ans={0,0};
    ll val=0,cnt=0;
    for(ll j=0;j<=lim;j++)
    {
        ll temp=(mask|(1<<j));
        ll setbit=__builtin_popcount(temp);
        if(setbit>k)
            continue;
        if(zero && j==0)
        {
            ans=fun(i+1,0,0,1);
            cnt=(cnt+ans.ff)%M;
            val=(val+(ans.ff*(j*p[s.size()-i-1])%M)%M)%M;
            val=(val+ans.ss)%M;
            continue;
        }
        if(j==lim && tight)
        {
            ans=fun(i+1,temp,1,0);
            cnt=(cnt+ans.ff)%M;
            val=(val+(ans.ff*(j*p[s.size()-i-1])%M)%M)%M;
            val=(val+ans.ss)%M;
            continue;
        }
        ans=fun(i+1,temp,0,0);
        cnt=(cnt+ans.ff)%M;
        val=(val+(ans.ff*(j*p[s.size()-i-1])%M)%M)%M;
        val=(val+ans.ss)%M;
    }
    return dp[i][mask][tight][zero]={cnt,val};
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    p[0]=1;
    for(ll i=1;i<=18;i++)
        p[i]=(p[i-1]*10LL)%M;
    cin>>l>>r>>k;
    l--;
    s=to_string1(l);
    memset(dp,-1,sizeof dp);
    pair<ll,ll> val1=fun(0,0,1,1);
    memset(dp,-1,sizeof dp);
    s=to_string1(r);
    pair<ll,ll> val2=fun(0,0,1,1);
    cout<<(val2.ss-val1.ss+M)%M<<"\n";
    return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<queue>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
#define M 1001
#define N 10
#define Mod 998244353
#define LL long long
#define pai pair<LL,LL>
void read(LL &x) {
    x = 0;
    LL f = 1;
    char c=getchar();
    while (c<'0'||c>'9'){
        if(c=='-')
            f=-f;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x << 1)+(x << 3)+c - '0';
        c=getchar();
    }
    x*=f;
    return;
}
LL fs(LL x){
	return x<0?-x:x;
}
void print(LL x){
	if(x<10){
		putchar(x+'0');
		return ;
	}
	print(x/10);
	putchar(x%10+'0');
	return ;
}
void write(LL x){
	if(x<0){
		putchar('-');
		x=fs(x);
	}
	print(x);
	return ;
}
LL mint(LL x,LL y){
	return x<y?x:y;
}
LL maxt(LL x,LL y){
	return x>y?x:y;
}
LL l,r,k,pow_[N<<1],f[N<<1][1<<N][2][2],g[N<<1][1<<N][2][2],a[N<<1],bit[1<<N];
void dfs(LL pos,LL s,bool qd,bool sx){
	if(pos==0){
		f[pos][s][qd][sx]=0;
		g[pos][s][qd][sx]=bit[s]<=k;
		return ;
	}
	if(~g[pos][s][qd][sx])
		return ;
	LL up=sx?a[pos]:9;
	f[pos][s][qd][sx]=g[pos][s][qd][sx]=0;
	for(int i=0;i<=up;i++){
		LL ns=(qd&&(!i))?s:(s|(1<<i));
		dfs(pos-1,ns,qd&&(!i),sx&&i==up);
		g[pos][s][qd][sx]=(g[pos][s][qd][sx]+g[pos-1][ns][qd&&(!i)][sx&&i==up])%Mod;
		f[pos][s][qd][sx]=(f[pos][s][qd][sx]+(f[pos-1][ns][qd&&(!i)][sx&&i==up]+(g[pos-1][ns][qd&&(!i)][sx&&i==up]*(pow_[pos-1]*i)%Mod)%Mod)%Mod)%Mod;
	}
	return ;
}
LL solve(LL x){
	memset(f,-1,sizeof(f));
	memset(g,-1,sizeof(g));
	memset(a,0,sizeof(a));
	LL len=0;
	while(x){
		a[++len]=x%10;
		x/=10;
	}
	dfs(len,0,1,1);
	return f[len][0][1][1];
}
int main(){
	pow_[0]=1,bit[0]=0;
	for(int i=1;i<1<<N;i++)
		if(i&1)
			bit[i]=bit[i>>1]+1;
		else
			bit[i]=bit[i>>1];
	for(int i=1;i<=18;i++)
		pow_[i]=((pow_[i-1]<<3)%Mod+(pow_[i-1]<<1)%Mod)%Mod;
	read(l),read(r),read(k);
	printf("%lld",(solve(r)-solve(l-1)+Mod)%Mod);
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<queue>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
#define M 1001
#define N 10
#define Mod 998244353
#define LL long long
#define pai pair<LL,LL>
void read(LL &x) {
    x = 0;
    LL f = 1;
    char c=getchar();
    while (c<'0'||c>'9'){
        if(c=='-')
            f=-f;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x << 1)+(x << 3)+c - '0';
        c=getchar();
    }
    x*=f;
    return;
}
LL fs(LL x){
	return x<0?-x:x;
}
void print(LL x){
	if(x<10){
		putchar(x+'0');
		return ;
	}
	print(x/10);
	putchar(x%10+'0');
	return ;
}
void write(LL x){
	if(x<0){
		putchar('-');
		x=fs(x);
	}
	print(x);
	return ;
}
LL mint(LL x,LL y){
	return x<y?x:y;
}
LL maxt(LL x,LL y){
	return x>y?x:y;
}
LL l,r,k,pow_[N],f[N<<1][1<<N][2][2],g[N<<1][1<<N][2][2],a[N<<1],bit[1<<N];
void dfs(LL pos,LL s,bool qd,bool sx){
	if(pos==0){
		f[pos][s][qd][sx]=0;
		g[pos][s][qd][sx]=bit[s]<=k;
		return ;
	}
	if(~g[pos][s][qd][sx])
		return ;
	LL up=sx?a[pos]:9;
	f[pos][s][qd][sx]=g[pos][s][qd][sx]=0;
	for(int i=0;i<=up;i++){
		LL ns=(qd&&(!i))?s:(s|(1<<i));
		dfs(pos-1,ns,qd&&(!i),sx&&i==up);
		g[pos][s][qd][sx]=(g[pos][s][qd][sx]+g[pos-1][ns][qd&&(!i)][sx&&i==up])%Mod;
		f[pos][s][qd][sx]=(f[pos][s][qd][sx]+(f[pos-1][ns][qd&&(!i)][sx&&i==up]+(g[pos-1][ns][qd&&(!i)][sx&&i==up]*(pow_[pos-1]*i)%Mod)%Mod)%Mod)%Mod;
	}
	return ;
}
LL solve(LL x){
	memset(f,-1,sizeof(f));
	memset(g,-1,sizeof(g));
	memset(a,0,sizeof(a));
	LL len=0;
	while(x){
		a[++len]=x%10;
		x/=10;
	}
	dfs(len,0,1,1);
	return f[len][0][1][1];
}
int main(){
	pow_[0]=1,bit[0]=0;
	for(int i=1;i<1<<N;i++)
		if(i&1)
			bit[i]=bit[i>>1]+1;
		else
			bit[i]=bit[i>>1];
	for(int i=1;i<=18;i++)
		pow_[i]=((pow_[i-1]<<3)%Mod+(pow_[i-1]<<1)%Mod)%Mod;
	read(l),read(r),read(k);
	printf("%lld",solve(r)-solve(l-1));
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<queue>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
#define M 1001
#define N 10
#define Mod 998244353
#define LL long long
#define pai pair<LL,LL>
void read(LL &x) {
    x = 0;
    LL f = 1;
    char c=getchar();
    while (c<'0'||c>'9'){
        if(c=='-')
            f=-f;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x << 1)+(x << 3)+c - '0';
        c=getchar();
    }
    x*=f;
    return;
}
LL fs(LL x){
	return x<0?-x:x;
}
void print(LL x){
	if(x<10){
		putchar(x+'0');
		return ;
	}
	print(x/10);
	putchar(x%10+'0');
	return ;
}
void write(LL x){
	if(x<0){
		putchar('-');
		x=fs(x);
	}
	print(x);
	return ;
}
LL mint(LL x,LL y){
	return x<y?x:y;
}
LL maxt(LL x,LL y){
	return x>y?x:y;
}
LL l,r,k,pow_[N<<1],f[N<<1][1<<N][2][2],g[N<<1][1<<N][2][2],a[N<<1],bit[1<<N];
void dfs(LL pos,LL s,bool qd,bool sx){
	if(pos==0){
		f[pos][s][qd][sx]=0;
		g[pos][s][qd][sx]=bit[s]<=k;
		return ;
	}
	if(~g[pos][s][qd][sx])
		return ;
	LL up=sx?a[pos]:9;
	f[pos][s][qd][sx]=g[pos][s][qd][sx]=0;
	for(int i=0;i<=up;i++){
		LL ns=(qd&&(!i))?s:(s|(1<<i));
		dfs(pos-1,ns,qd&&(!i),sx&&i==up);
		g[pos][s][qd][sx]=(g[pos][s][qd][sx]+g[pos-1][ns][qd&&(!i)][sx&&i==up])%Mod;
		f[pos][s][qd][sx]=(f[pos][s][qd][sx]+(f[pos-1][ns][qd&&(!i)][sx&&i==up]+(g[pos-1][ns][qd&&(!i)][sx&&i==up]*(pow_[pos-1]*i)%Mod)%Mod)%Mod)%Mod;
	}
	return ;
}
LL solve(LL x){
	memset(f,-1,sizeof(f));
	memset(g,-1,sizeof(g));
	memset(a,0,sizeof(a));
	LL len=0;
	while(x){
		a[++len]=x%10;
		x/=10;
	}
	dfs(len,0,1,1);
	return f[len][0][1][1];
}
int main(){
	pow_[0]=1,bit[0]=0;
	for(int i=1;i<1<<N;i++)
		if(i&1)
			bit[i]=bit[i>>1]+1;
		else
			bit[i]=bit[i>>1];
	for(int i=1;i<=18;i++)
		pow_[i]=((pow_[i-1]<<3)%Mod+(pow_[i-1]<<1)%Mod)%Mod;
	read(l),read(r),read(k);
	printf("%lld",solve(r)-solve(l-1));
}


#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
const int mod=998244353;
const int maxs=1<<10;

int L,R,typ;
int f[20][maxs+100],g[20][maxs+100];

void In_();
int Solve_(int U);

int main()
{
//	freopen("e.in","r",stdin);
//	freopen("e.out","w",stdout);
	In_();
	cout << Solve_(R)-Solve_(L-1) << endl;
//	cout << Solve_(L-1) << " " << Solve_(R) << endl;
	return 0;
}

void In_()
{
	scanf("%d%d%d",&L,&R,&typ);
}

int Solve_(int U)
{
	if ( U==0 ) return 0;
	memset(f,0,sizeof(f));
	memset(g,0,sizeof(g));
	int a[20]={0},tmp=U,len=0;
	while ( tmp ) a[len++]=tmp%10,tmp/=10;
	for (int k=1;k<a[len-1];++k)
		f[1][1<<k]=k,g[1][1<<k]=1;
	LL now=a[len-1];
	int nows=1<<a[len-1];
	for (int i=1;i<len;++i)
	{
		for (int k=0;k<a[len-i-1];++k)
		{
			int t=nows|(1<<k);
			f[i+1][t]+=(now%mod*10%mod+k)%mod; f[i+1][t]%=mod;
			++g[i+1][t]; g[i+1][t]%=mod;
		}
		for (int k=1;k<10;++k)
		{
			f[i+1][1<<k]+=k;  f[i+1][1<<k]%=mod;
			++g[i+1][1<<k]; g[i+1][1<<k]%=mod;
		}
		for (int s=0;s<maxs;++s)
		{
			for (int k=0;k<10;++k)
			{
				int t=s|(1<<k);
				f[i+1][t]+=(f[i][s]*10%mod+g[i][s]*k%mod)%mod; f[i+1][t]%=mod;
				g[i+1][t]+=g[i][s]; g[i+1][t]%=mod;
			}
		}
		now=now*10+a[len-i-1];
		nows|=(1<<a[len-i-1]);
	}
	f[len][nows]+=now%mod; f[len][nows]%=mod;
	int ans=0;
	for (int s=0;s<maxs;++s)
	{
		int cnt=0;
		for (int k=0;k<10;++k)
			if ( s&(1<<k) ) ++cnt;
		if (cnt<=typ) ans+=f[len][s],ans%=mod;
	}
	return ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
const int mod=998244353;
const int maxs=1<<10;

LL L,R;
int typ;
int f[20][maxs+100],g[20][maxs+100];

void In_();
int Solve_(LL U);

int main()
{
//	freopen("e.in","r",stdin);
//	freopen("e.out","w",stdout);
	In_();
	cout << (Solve_(R)-Solve_(L-1)+mod)%mod << endl;
	return 0;
}

void In_()
{
	cin >> L >> R >> typ;
//	cout << R << endl;
}

int Solve_(LL U)
{
	if ( U==0 ) return 0;
	memset(f,0,sizeof(f));
	memset(g,0,sizeof(g));
	int a[20]={0},len=0;
	LL tmp=U;
	while ( tmp ) a[len++]=tmp%10,tmp/=10;
	for (int k=1;k<a[len-1];++k)
		f[1][1<<k]=k,g[1][1<<k]=1;
	int now=a[len-1];
	int nows=1<<a[len-1];
	for (int i=1;i<len;++i)
	{
		for (int k=0;k<a[len-i-1];++k)
		{
			int t=nows|(1<<k);
			f[i+1][t]+=(LL(now)*10%mod+k)%mod; f[i+1][t]%=mod;
			++g[i+1][t]; g[i+1][t]%=mod;
		}
		for (int k=1;k<10;++k)
		{
			f[i+1][1<<k]+=k;  f[i+1][1<<k]%=mod;
			++g[i+1][1<<k]; g[i+1][1<<k]%=mod;
		}
		for (int s=0;s<maxs;++s)
		{
			for (int k=0;k<10;++k)
			{
				int t=s|(1<<k);
				f[i+1][t]+=(LL(f[i][s])*10%mod+LL(g[i][s])*k%mod)%mod; f[i+1][t]%=mod;
				g[i+1][t]+=g[i][s]; g[i+1][t]%=mod;
			}
		}
		now=LL(now)*10%mod+a[len-i-1]; now%=mod;
		nows|=(1<<a[len-i-1]);
	}
	f[len][nows]+=now; f[len][nows]%=mod;
	int ans=0;
	for (int s=0;s<maxs;++s)
	{
		int cnt=0;
		for (int k=0;k<10;++k)
			if ( s&(1<<k) ) ++cnt;
		if (cnt<=typ) ans+=f[len][s],ans%=mod;
	}
	return ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
const int mod=998244353;
const int maxs=1<<10;

LL L,R;
int typ;
int f[20][maxs+100],g[20][maxs+100];

void In_();
int Solve_(LL U);

int main()
{
//	freopen("e.in","r",stdin);
//	freopen("e.out","w",stdout);
	In_();
	cout << Solve_(R)-Solve_(L-1) << endl;
//	cout << Solve_(L-1) << " " << Solve_(R) << endl;
	return 0;
}

void In_()
{
	cin >> L >> R >> typ;
}

int Solve_(LL U)
{
	if ( U==0 ) return 0;
	memset(f,0,sizeof(f));
	memset(g,0,sizeof(g));
	int a[20]={0},tmp=U,len=0;
	while ( tmp ) a[len++]=tmp%10,tmp/=10;
	for (int k=1;k<a[len-1];++k)
		f[1][1<<k]=k,g[1][1<<k]=1;
	LL now=a[len-1];
	int nows=1<<a[len-1];
	for (int i=1;i<len;++i)
	{
		for (int k=0;k<a[len-i-1];++k)
		{
			int t=nows|(1<<k);
			f[i+1][t]+=(now%mod*10%mod+k)%mod; f[i+1][t]%=mod;
			++g[i+1][t]; g[i+1][t]%=mod;
		}
		for (int k=1;k<10;++k)
		{
			f[i+1][1<<k]+=k;  f[i+1][1<<k]%=mod;
			++g[i+1][1<<k]; g[i+1][1<<k]%=mod;
		}
		for (int s=0;s<maxs;++s)
		{
			for (int k=0;k<10;++k)
			{
				int t=s|(1<<k);
				f[i+1][t]+=(f[i][s]*10%mod+g[i][s]*k%mod)%mod; f[i+1][t]%=mod;
				g[i+1][t]+=g[i][s]; g[i+1][t]%=mod;
			}
		}
		now=now*10+a[len-i-1];
		nows|=(1<<a[len-i-1]);
	}
	f[len][nows]+=now%mod; f[len][nows]%=mod;
	int ans=0;
	for (int s=0;s<maxs;++s)
	{
		int cnt=0;
		for (int k=0;k<10;++k)
			if ( s&(1<<k) ) ++cnt;
		if (cnt<=typ) ans+=f[len][s],ans%=mod;
	}
	return ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
const int mod=998244353;
const int maxs=1<<10;

LL L,R;
int typ;
int f[20][maxs+100],g[20][maxs+100];

void In_();
int Solve_(LL U);

int main()
{
//	freopen("e.in","r",stdin);
//	freopen("e.out","w",stdout);
	In_();
	cout << (Solve_(R)-Solve_(L-1)+mod)%mod << endl;
	return 0;
}

void In_()
{
	cin >> L >> R >> typ;
}

int Solve_(LL U)
{
	if ( U==0 ) return 0;
	memset(f,0,sizeof(f));
	memset(g,0,sizeof(g));
	int a[20]={0},len=0;
	LL tmp=U;
	while ( tmp ) a[len++]=tmp%10,tmp/=10;
	for (int k=1;k<a[len-1];++k)
		f[1][1<<k]=k,g[1][1<<k]=1;
	int now=a[len-1];
	int nows=1<<a[len-1];
	for (int i=1;i<len;++i)
	{
		for (int k=0;k<a[len-i-1];++k)
		{
			int t=nows|(1<<k);
			f[i+1][t]+=(now*10%mod+k)%mod; f[i+1][t]%=mod;
			++g[i+1][t]; g[i+1][t]%=mod;
		}
		for (int k=1;k<10;++k)
		{
			f[i+1][1<<k]+=k;  f[i+1][1<<k]%=mod;
			++g[i+1][1<<k]; g[i+1][1<<k]%=mod;
		}
		for (int s=0;s<maxs;++s)
		{
			for (int k=0;k<10;++k)
			{
				int t=s|(1<<k);
				f[i+1][t]+=(LL(f[i][s])*10%mod+LL(g[i][s])*k%mod)%mod; f[i+1][t]%=mod;
				g[i+1][t]+=g[i][s]; g[i+1][t]%=mod;
			}
		}
		now=LL(now)*10%mod+a[len-i-1]; now%=mod;
		nows|=(1<<a[len-i-1]);
	}
	f[len][nows]+=now%mod; f[len][nows]%=mod;
	int ans=0;
	for (int s=0;s<maxs;++s)
	{
		int cnt=0;
		for (int k=0;k<10;++k)
			if ( s&(1<<k) ) ++cnt;
		if (cnt<=typ) ans+=f[len][s],ans%=mod;
	}
	return ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
const int mod=998244353;
const int maxs=1<<10;

LL L,R;
int typ;
int f[20][maxs+100],g[20][maxs+100];

void In_();
int Solve_(LL U);

int main()
{
//	freopen("e.in","r",stdin);
//	freopen("e.out","w",stdout);
	In_();
	cout << (Solve_(R)-Solve_(L-1)+mod)%mod << endl;
	return 0;
}

void In_()
{
	cin >> L >> R >> typ;
}

int Solve_(LL U)
{
	if ( U==0 ) return 0;
	memset(f,0,sizeof(f));
	memset(g,0,sizeof(g));
	int a[20]={0},len=0;
	LL tmp=U;
	while ( tmp ) a[len++]=tmp%10,tmp/=10;
	for (int k=1;k<a[len-1];++k)
		f[1][1<<k]=k,g[1][1<<k]=1;
	LL now=a[len-1];
	int nows=1<<a[len-1];
	for (int i=1;i<len;++i)
	{
		for (int k=0;k<a[len-i-1];++k)
		{
			int t=nows|(1<<k);
			f[i+1][t]+=(now%mod*10%mod+k)%mod; f[i+1][t]%=mod;
			++g[i+1][t]; g[i+1][t]%=mod;
		}
		for (int k=1;k<10;++k)
		{
			f[i+1][1<<k]+=k;  f[i+1][1<<k]%=mod;
			++g[i+1][1<<k]; g[i+1][1<<k]%=mod;
		}
		for (int s=0;s<maxs;++s)
		{
			for (int k=0;k<10;++k)
			{
				int t=s|(1<<k);
				f[i+1][t]+=(f[i][s]*10%mod+g[i][s]*k%mod)%mod; f[i+1][t]%=mod;
				g[i+1][t]+=g[i][s]; g[i+1][t]%=mod;
			}
		}
		now=now*10+a[len-i-1];
		nows|=(1<<a[len-i-1]);
	}
	f[len][nows]+=now%mod; f[len][nows]%=mod;
	int ans=0;
	for (int s=0;s<maxs;++s)
	{
		int cnt=0;
		for (int k=0;k<10;++k)
			if ( s&(1<<k) ) ++cnt;
		if (cnt<=typ) ans+=f[len][s],ans%=mod;
	}
	return ans;
}


#include<bits/stdc++.h>

using namespace std;
const int MAXN = 20;

#define int long long

const int mod = 998244353;

int n,m,k;
int pot[MAXN];
int pot10[MAXN];

int menor[MAXN],maior[MAXN];
pair<int,int> pd[MAXN][1050][2][2];

pair<int,int> func(int pos,int mask,int f1,int f2){

	if(pos == n+1){

		int at = mask;
		int cont = 0;

		while(at > 0){
			cont ++;
			at -= (at&-at);
		}

		if(cont <= k) return {0,1};
		else return {0,0};
	}

	if(pd[pos][mask][f1][f2].first != -1) return pd[pos][mask][f1][f2];

	pair<int,int> r = {0,0};

	for(int i = 0;i <= 9;i++){

		if(f1 == 0 && i < menor[pos]) continue;
		if(f2 == 0 && i > maior[pos]) continue;

		int t1,t2;

		if(f1 == 0 && i == menor[pos]) t1 = 0;
		else t1 = 1;

		if(f2 == 0 && i == pos[maior]) t2 = 0;
		else t2 = 1;

		int mk = mask;
		mk |= pot[i];

		pair<int,int> h = func(pos + 1,mk,t1,t2);

		r.first += h.second*(i*pot10[n - pos]);
		r.first += h.first;
		r.second += h.second;

		r.first %= mod , r.second %= mod;
	}

	pd[pos][mask][f1][f2] = return r;
}

signed main(){
	memset(pd,-1,sizeof pd);

	string s1,s2;
	cin >> s1 >> s2 >> k;

	string comp;

	for(int i = 1;i <= s2.size() - s1.size();i++) comp += '0';
	s1 = comp + s1;

	for(int i = 0;i < s1.size();i++) menor[i+1] = s1[i] - '0';
	for(int i = 0;i < s2.size();i++) maior[i+1] = s2[i] - '0';

	n = s1.size();

	int p2 = 1,p10 = 1;

	for(int i = 0;i < MAXN-2;i++){
		pot[i] = p2;
		p2 *= 2;

		pot[i] %= mod;
		p2 %= mod;
	}
	for(int i = 0;i < MAXN;i++){
		pot10[i] = p10;
		p10 *= 10;

		pot10[i] %= mod;
		p10 %= mod;
	}

	cout << func(1,0,0,0).first << endl;

}


#include<bits/stdc++.h>

using namespace std;
const int MAXN = 20;

#define int long long

const int mod = 998244353;

int n,m,k;
int pot[MAXN];
int pot10[MAXN];

int menor[MAXN],maior[MAXN];
pair<int,int> pd[MAXN][1050][2][2];

pair<int,int> func(int pos,int mask,int f1,int f2){

	if(pos == n+1){

		int at = mask;
		int cont = 0;

		while(at > 0){
			cont ++;
			at -= (at&-at);
		}

		if(cont <= k) return {0,1};
		else return {0,0};
	}

	if(pd[pos][mask][f1][f2].first != -1) return pd[pos][mask][f1][f2];

	pair<int,int> r = {0,0};

	for(int i = 0;i <= 9;i++){

		if(f1 == 0 && i < menor[pos]) continue;
		if(f2 == 0 && i > maior[pos]) continue;

		int t1,t2;

		if(f1 == 0 && i == menor[pos]) t1 = 0;
		else t1 = 1;

		if(f2 == 0 && i == pos[maior]) t2 = 0;
		else t2 = 1;

		int mk = mask;
		mk |= pot[i];

		pair<int,int> h = func(pos + 1,mk,t1,t2);

		r.first += h.second*(i*pot10[n - pos]);
		r.first += h.first;
		r.second += h.second;

		r.first %= mod , r.second %= mod;
	}

	return pd[pos][mask][f1][f2] = r;
}

signed main(){
	memset(pd,-1,sizeof pd);

	string s1,s2;
	cin >> s1 >> s2 >> k;

	string comp;

	for(int i = 1;i <= s2.size() - s1.size();i++) comp += '0';
	s1 = comp + s1;

	for(int i = 0;i < s1.size();i++) menor[i+1] = s1[i] - '0';
	for(int i = 0;i < s2.size();i++) maior[i+1] = s2[i] - '0';

	n = s1.size();

	int p2 = 1,p10 = 1;

	for(int i = 0;i < MAXN-2;i++){
		pot[i] = p2;
		p2 *= 2;

		pot[i] %= mod;
		p2 %= mod;
	}
	for(int i = 0;i < MAXN;i++){
		pot10[i] = p10;
		p10 *= 10;

		pot10[i] %= mod;
		p10 %= mod;
	}

	cout << func(1,0,0,0).first << endl;

}


#include<bits/stdc++.h>

using namespace std;
const int MAXN = 20;

#define int long long

const int mod = 998244353;

int n,m,k;
int pot[MAXN];
int pot10[MAXN];

int menor[MAXN],maior[MAXN];
pair<int,int> pd[MAXN][2000][2][2];

pair<int,int> func(int pos,int mask,int f1,int f2){

	//cout << pos << " " << mask << " " << f1 << " " << f2 << endl;

	if(pos == n+1){

		int at = mask;
		int cont = 0;

		while(at > 0){
			cont ++;
			at -= (at&-at);
		}

		if(cont <= k) return {0,1};
		else return {0,0};
	}

	if(pd[pos][mask][f1][f2].first != -1) return pd[pos][mask][f1][f2];

	pair<int,int> r = {0,0};

	for(int i = 0;i <= 9;i++){

		if(f1 == 0 && i < menor[pos]) continue;
		if(f2 == 0 && i > maior[pos]) continue;

		int t1,t2;

		if(f1 == 0 && i == menor[pos]) t1 = 0;
		else t1 = 1;

		if(f2 == 0 && i == pos[maior]) t2 = 0;
		else t2 = 1;

		int mk = mask;
		mk |= pot[i];

		pair<int,int> h = func(pos + 1,mk,t1,t2);

		r.first += h.second*(i*pot10[n - pos]);
		r.first += h.first;
		r.second += h.second;

		r.first %= mod , r.second %= mod;
	}

	return r;
}

signed main(){
	memset(pd,-1,sizeof pd);

	string s1,s2;
	cin >> s1 >> s2 >> k;

	string comp;

	for(int i = 1;i <= s2.size() - s1.size();i++) comp += '0';
	s1 = comp + s1;

	for(int i = 0;i < s1.size();i++) menor[i+1] = s1[i] - '0';
	for(int i = 0;i < s2.size();i++) maior[i+1] = s2[i] - '0';

	n = s1.size();

	int p2 = 1,p10 = 1;

	for(int i = 0;i < MAXN-2;i++){
		pot[i] = p2;
		p2 *= 2;

		pot[i] %= mod;
		p2 %= mod;
	}
	for(int i = 0;i < MAXN;i++){
		pot10[i] = p10;
		p10 *= 10;

		pot10[i] %= mod;
		p10 %= mod;
	}

	cout << func(1,0,0,0).first << endl;

}


#include<bits/stdc++.h>

using namespace std;
const int MAXN = 20;

#define int long long

const int mod = 998244353;
int n,m,k;
int pot[MAXN];
int pot10[MAXN];

int menor[MAXN],maior[MAXN];
pair<int,int> pd[MAXN][1050][2][2][2];

pair<int,int> func(int pos,int mask,int f1,int f2,int f0){

	if(pos == n+1){

		int at = mask;
		int cont = 0;

		while(at > 0){
			cont ++;
			at -= (at&-at);
		}

		if(cont <= k) return {0,1};
		else return {0,0};
	}

	if(pd[pos][mask][f1][f2][f0].first != -1) return pd[pos][mask][f1][f2][f0];

	pair<int,int> r = {0,0};

	for(int i = 0;i <= 9;i++){

		if(f1 == 0 && i < menor[pos]) continue;
		if(f2 == 0 && i > maior[pos]) continue;

		int t1,t2;

		if(f1 == 0 && i == menor[pos]) t1 = 0;
		else t1 = 1;

		if(f2 == 0 && i == pos[maior]) t2 = 0;
		else t2 = 1;

		int ff = f0;

		if(i != 0 && f0 == 1) ff = 0;

		int mk = mask;
		if(ff == 0) mk |= pot[i];

		pair<int,int> h = func(pos + 1,mk,t1,t2,ff);

		//cout << i << " " << n - pos << " " << h.second << endl;

		r.first += h.second*((i*pot10[n - pos])%mod);
		r.first += h.first;
		r.second += h.second;

		r.first = r.first%mod;
		r.second = r.second%mod;
	}

	return pd[pos][mask][f1][f2][f0] = r;
}

signed main(){
	memset(pd,-1,sizeof pd);

	string s1,s2;
	cin >> s1 >> s2 >> k;

	string comp;

	for(int i = 1;i <= s2.size() - s1.size();i++) comp += '0';
	s1 = comp + s1;

	for(int i = 0;i < s1.size();i++) menor[i+1] = s1[i] - '0';
	for(int i = 0;i < s2.size();i++) maior[i+1] = s2[i] - '0';

	n = s1.size();

	int p2 = 1,p10 = 1;

	for(int i = 0;i < 12;i++){
		pot[i] = p2;
		p2 *= 2;
	}
	for(int i = 0;i < MAXN;i++){
		pot10[i] = p10;
		p10 *= 10;

		pot10[i] %= mod;
		p10 %= mod;
	}

	cout << func(1,0,0,0,1).first << endl;

}


// It's gonna End soon , sooner than it started .
#include "bits/stdc++.h"
#define pb push_back
using ll = long long;
using namespace std;
// #define endl "\n";
void D(){
	ll n ; cin>>n;

	ll currmax  = rand() % (n+1);

	for(int i =1;i<=n;i++){
		if(i == currmax)
			continue;
		cout<<"? " << i << " "<< currmax<<endl;
		flush(cout);
		ll f  ; cin>>f;
		cout<<"? " << currmax << " "<< i<<endl;
		flush(cout);
		ll s  ; cin>>s;
		if(f < s){
			currmax =i;
		}
	}
	// cout<<currmax<<endl;
	vector<int> ans;
	bool first = true;
	for(int i =1;i<=n;i++){
		if(i==currmax){
			ans.push_back(n);
		}
		else{

			cout<<"? " << i << " "<< currmax<<endl;
			flush(cout);
			ll f  ; cin>>f;
			ans.push_back(f);
		}
	}
	cout<<"! ";
	for(auto i : ans){
		cout<<i<<" ";
	}
	cout<<endl;
	flush(cout);
	exit(0);

}

int main(int argc, char const *argv[])
{

	ll t =1;
	srand(time(0));
	// cin>>t;
	while(t--){
		D();
	}

}


// It's gonna End soon , sooner than it started .
#include "bits/stdc++.h"
#define pb push_back
using ll = long long;
using namespace std;
// #define endl "\n";
void D(){
	ll n ; cin>>n;

	ll currmax  ;

	while( (currmax =rand() % (n+1)) ==0 ){

	}
	// cout<<currmax<<endl;

	for(int i =1;i<=n;i++){
		if(i == currmax)
			continue;
		cout<<"? " << i << " "<< currmax<<endl;
		flush(cout);
		ll f  ; cin>>f;
		cout<<"? " << currmax << " "<< i<<endl;
		flush(cout);
		ll s  ; cin>>s;
		if(f < s){
			currmax =i;
		}
	}
	// cout<<currmax<<endl;
	vector<int> ans;
	bool first = true;
	for(int i =1;i<=n;i++){
		if(i==currmax){
			ans.push_back(n);
		}
		else{

			cout<<"? " << i << " "<< currmax<<endl;
			flush(cout);
			ll f  ; cin>>f;
			ans.push_back(f);
		}
	}
	cout<<"! ";
	for(auto i : ans){
		cout<<i<<" ";
	}
	cout<<endl;
	flush(cout);
	exit(0);

}

int main(int argc, char const *argv[])
{

	ll t =1;
	srand(time(0));
	// cin>>t;
	while(t--){
		D();
	}

}


// It's gonna End soon , sooner than it started .
#include "bits/stdc++.h"
#define pb push_back
using ll = long long;
using namespace std;
// #define endl "\n";
void D(){
	ll n ; cin>>n;

	ll currmax  = 1;
	ll nquery =2*n;
	for(int i =1;i<=n;i++){
		if(i == currmax)
			continue;
		cout<<"? " << i << " "<< currmax<<endl;
		flush(cout);
		ll f  ; cin>>f;
		cout<<"? " << currmax << " "<< i<<endl;
		flush(cout);
		nquery -=2;
		ll s  ; cin>>s;
		if(f < s){
			currmax =i;
		}
	}
	// cout<<currmax<<endl;
	set<int>s;
	for(int i =1;i<=n;i++){
		s.insert(i);
	}
	vector<int> ans;
	bool first = true;
	for(int i =1;i<=n;i++){
		if(i==currmax){
			ans.push_back(n);
			s.erase(n);
		}
		else{
			if(nquery>0){
				cout<<"? " << i << " "<< currmax<<endl;
				flush(cout);
				ll f  ; cin>>f;
				s.erase(f);
				ans.push_back(f);
				nquery--;
			}
			else{
				ans[i] = -1;
			}
		}
	}
	for(int i =0 ; i<n;i++){
		if(ans[i] == -1){
			ans[i] = *s.begin();
		}
	}
	cout<<"! ";
	for(auto i : ans){
		cout<<i<<" ";
	}
	cout<<endl;
	flush(cout);
	exit(0);

}

int main(int argc, char const *argv[])
{

	ll t =1;
	// cin>>t;
	while(t--){
		D();
	}

}


// It's gonna End soon , sooner than it started .
#include "bits/stdc++.h"
#define pb push_back
using ll = long long;
using namespace std;
// #define endl "\n";
void D(){
	ll n ; cin>>n;

	ll currmax =1 ;

	// while( (currmax =rand() % (n+1)) ==0 ){

	// }
	// cout<<currmax<<endl;
	vector<int> ans(n,-1);
	for(int i =1;i<=n;i++){
		if(i == currmax)
			continue;
		cout<<"? " << i << " "<< currmax<<endl;
		flush(cout);
		ll f  ; cin>>f;
		cout<<"? " << currmax << " "<< i<<endl;
		flush(cout);
		ll s  ; cin>>s;
		if(f < s){
			ans[currmax-1] = f;
			currmax =i;

		}
		else{
			ans[i-1] = s;
		}
	}
	// cout<<currmax<<endl;

	bool first = true;
	for(int i =1;i<=n;i++){
		if(i==currmax){
			ans[i-1] = n;
		}
		else if(ans[i-1] ==-1){

			cout<<"? " << i << " "<< currmax<<endl;
			flush(cout);
			ll f  ; cin>>f;
			ans[i-1] = f;
		}
	}
	cout<<"! ";
	for(auto i : ans){
		cout<<i<<" ";
	}
	cout<<endl;
	flush(cout);
	exit(0);

}

int main(int argc, char const *argv[])
{

	ll t =1;
	srand(time(0));
	// cin>>t;
	while(t--){
		D();
	}

}


#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

bool f(ll a,ll b){
    return a>b;
}

int main() {
	// your code goes here
	ll t,n,k,k1;
	cin>>n;
	ll ans[n+1];
	bool vis[n+1];
	bool number[n+1];
	ll cnt=0;
	for(int i=0;i<=n;i++){vis[i]=false;
	number[i]=false;}
	    int i=1,j=2;
	while(cnt!=n-1){
	if(i>n || j>n)break;
	cout<<"? "<<i<<" "<<j<<endl;
	cin>>k;
	cout<<"? "<<j<<" "<<i<<endl;
	cin>>k1;
	if(k>k1){ans[i]=k;
	    vis[i]=true;
	    number[k]=true;
	    i++;
	    while(i<=n && vis[i])i++;
	    if(i==j)
	    i++;
	   while(i<=n && vis[i])i++;
	}
	else {ans[j]=k1;
	vis[j]=true;
	j++;
	while(j<=n && vis[j])j++;
	if(i==j)j++;
	while(j<=n && vis[j])j++;
	number[k1]=true;
	}
	cnt++;
	}
	int idx=-1;
	int no=-1;
	for(int i=1;i<=n;i++){
	    if(!vis[i])idx=i;
	    if(!number[i]) no=i;
	}
	ans[idx]=no;
	cout<<"! ";
	for(int i=1;i<=n;i++)cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

bool f(ll a,ll b){
    return a>b;
}

int main() {
	// your code goes here
	ll t,n,k,k1;
	ll ans[n];
	bool vis[n+1];
	bool number[n+1];
	ll cnt=0;
	for(int i=0;i<=n;i++){vis[i]=false;
	number[i]=false;}
	    int i=1,j=2;
	while(cnt!=n-1){

	cout<<"? "<<i<<" "<<j<<endl;
	cin>>k;
	cout<<"? "<<j<<" "<<i<<endl;
	cin>>k1;
	if(k>k1){ans[i]=k;
	    vis[i]=true;
	    number[k]=true;
	    i++;
	    while(i<=n && vis[i])i++;
	    if(i==j)
	    i++;
	   while(i<=n && vis[i])i++;
	}
	else {ans[j]=k1;
	vis[j]=true;
	j++;
	while(j<=n && vis[j])j++;
	if(i==j)j++;
	while(j<=n && vis[j])j++;
	number[k1]=true;
	}
	cnt++;
	}
	int idx=-1;
	int no=-1;
	for(int i=1;i<=n;i++){
	    if(!vis[i])idx=i;
	    if(!number[i]) no=i;
	}
	cout<<"! ";
	for(int i=0;i<n;i++)cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

bool f(ll a,ll b){
    return a>b;
}

int main() {
	// your code goes here
	ll t,n,k,k1;
	ll ans[n];
	bool vis[n+1];
	bool number[n+1];
	ll cnt=0;
	for(int i=0;i<=n;i++){vis[i]=false;
	number[i]=false;}
	    int i=1,j=2;
	while(cnt!=n-1){

	cout<<"? "<<i<<" "<<j<<endl;
	cin>>k;
	cout<<"? "<<j<<" "<<i<<endl;
	cin>>k1;
	if(k>k1){ans[i]=k;
	    vis[i]=true;
	    number[k]=true;
	    i++;
	    while(vis[i])i++;
	}
	else {ans[j]=k1;
	vis[j]=true;
	j++;
	while(vis[j])j++;
	number[k1]=true;
	}
	cnt++;
	}
	int idx=-1;
	int no=-1;
	for(int i=1;i<=n;i++){
	    if(!vis[i])idx=i;
	    if(!number[i]) no=i;
	}
	cout<<"! ";
	for(int i=0;i<n;i++)cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

bool f(ll a,ll b){
    return a>b;
}

int main() {
	// your code goes here
	ll t,n,k,k1;
	ll ans[n];
	bool vis[n+1];
	bool number[n+1];
	ll cnt=0;
	for(int i=0;i<=n;i++){vis[i]=false;
	number[i]=false;}
	while(cnt!=n-1){
	    int i=1,j=2;
	cout<<"? "<<i<<" "<<j<<endl;
	cin>>k;
	cout<<"? "<<j<<" "<<i<<endl;
	cin>>k1;
	if(k>k1){ans[i]=k;
	    vis[i]=true;
	    number[k]=true;
	}
	else {ans[j]=k1;
	vis[j]=true;
	number[k1]=true;
	}
	cnt++;
    i++;
    j++;
	}
	int idx=-1;
	int no=-1;
	for(int i=1;i<=n;i++){
	    if(!vis[i])idx=i;
	    if(!number[i]) no=i;
	}
	cout<<"! ";
	for(int i=0;i<n;i++)cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

bool f(ll a,ll b){
    return a>b;
}

int main() {
	// your code goes here
	ll t,n,k,k1;
	ll ans[n];
	bool vis[n+1];
	bool number[n+1];
	ll cnt=0;
	for(int i=0;i<=n;i++){vis[i]=false;
	number[i]=false;}
	while(cnt!=n-1){
	    int i=1,j=2;
	cout<<"? "<<i<<" "<<j<<endl;
	cin>>k;
	cout<<"? "<<j<<" "<<i<<endl;
	cin>>k1;
	if(k>k1){ans[i]=k;
	    vis[i]=true;
	    number[k]=true;
	    i++;
	    while(vis[i])i++;
	}
	else {ans[j]=k1;
	vis[j]=true;
	j++;
	while(vis[j])j++;
	number[k1]=true;
	}
	cnt++;
    // i++;
    // j++;
	}
	int idx=-1;
	int no=-1;
	for(int i=1;i<=n;i++){
	    if(!vis[i])idx=i;
	    if(!number[i]) no=i;
	}
	cout<<"! ";
	for(int i=0;i<n;i++)cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

bool f(ll a,ll b){
    return a>b;
}

int main() {
	// your code goes here
	ll t,n,k,k1;
	ll ans[n+1];
	bool vis[n+1];
	bool number[n+1];
	ll cnt=0;
	for(int i=0;i<=n;i++){vis[i]=false;
	number[i]=false;}
	    int i=1,j=2;
	while(cnt!=n-1){

	cout<<"? "<<i<<" "<<j<<endl;
	cin>>k;
	cout<<"? "<<j<<" "<<i<<endl;
	cin>>k1;
	if(k>k1){ans[i]=k;
	    vis[i]=true;
	    number[k]=true;
	    i++;
	    while(i<=n && vis[i])i++;
	    if(i==j)
	    i++;
	   while(i<=n && vis[i])i++;
	}
	else {ans[j]=k1;
	vis[j]=true;
	j++;
	while(j<=n && vis[j])j++;
	if(i==j)j++;
	while(j<=n && vis[j])j++;
	number[k1]=true;
	}
	cnt++;
	}
	int idx=-1;
	int no=-1;
	for(int i=1;i<=n;i++){
	    if(!vis[i])idx=i;
	    if(!number[i]) no=i;
	}
	cout<<"! ";
	for(int i=1;i<=n;i++)cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

bool f(ll a,ll b){
    return a>b;
}

int main() {
	// your code goes here
	ll t,n,k,k1;
	ll ans[n];
	bool vis[n+1];
	bool number[n+1];
	ll cnt=0;
	for(int i=0;i<=n;i++){vis[i]=false;
	number[i]=false;}
	    int i=1,j=2;
	while(cnt!=n-1){

	cout<<"? "<<i<<" "<<j<<endl;
	cin>>k;
	cout<<"? "<<j<<" "<<i<<endl;
	cin>>k1;
	if(k>k1){ans[i]=k;
	    vis[i]=true;
	    number[k]=true;
	    i++;
	    while(vis[i])i++;
	    if(i==j)
	    i++;
	   while(vis[i])i++;
	}
	else {ans[j]=k1;
	vis[j]=true;
	j++;
	while(vis[j])j++;
	if(i==j)j++;
	while(vis[j])j++;
	number[k1]=true;
	}
	cnt++;
	}
	int idx=-1;
	int no=-1;
	for(int i=1;i<=n;i++){
	    if(!vis[i])idx=i;
	    if(!number[i]) no=i;
	}
	cout<<"! ";
	for(int i=0;i<n;i++)cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

bool f(ll a,ll b){
    return a>b;
}

int main() {
	// your code goes here
	ll t,n,k,k1;
	ll ans[n+1];
	bool vis[n+1];
	bool number[n+1];
	ll cnt=0;
	for(int i=0;i<=n;i++){vis[i]=false;
	number[i]=false;}
	    int i=1,j=2;
	while(cnt!=n-1){

	cout<<"? "<<i<<" "<<j<<endl;
	cin>>k;
	cout<<"? "<<j<<" "<<i<<endl;
	cin>>k1;
	if(k>k1){ans[i]=k;
	    vis[i]=true;
	    number[k]=true;
	    i++;
	    while(i<=n && vis[i])i++;
	    if(i==j)
	    i++;
	   while(i<=n && vis[i])i++;
	}
	else {ans[j]=k1;
	vis[j]=true;
	j++;
	while(j<=n && vis[j])j++;
	if(i==j)j++;
	while(j<=n && vis[j])j++;
	number[k1]=true;
	}
	cnt++;
	}
	int idx=-1;
	int no=-1;
	for(int i=1;i<=n;i++){
	    if(!vis[i])idx=i;
	    if(!number[i]) no=i;
	}
	ans[idx]=no;
	cout<<"! ";
	for(int i=1;i<=n;i++)cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

bool f(ll a,ll b){
    return a>b;
}

int main() {
	// your code goes here
	ll t,n,k,k1;
	ll ans[n];
	bool vis[n+1];
	bool number[n+1];
	ll cnt=0;
	for(int i=0;i<=n;i++){vis[i]=false;
	number[i]=false;}
	while(cnt!=n-1){
	    int i=1,j=2;
	cout<<"? "<<i<<" "<<j<<endl;
	cin>>k;
	if(k==-1)return 0;
	cout<<"? "<<j<<" "<<i<<endl;
	cin>>k1;
	if(k1==-1)return 0;
	if(k>k1){ans[i]=k;
	    vis[i]=true;
	    number[k]=true;
	}
	else {ans[j]=k1;
	vis[j]=true;
	number[k1]=true;
	}
	cnt++;
    i++;
    j++;
	}
	int idx=-1;
	int no=-1;
	for(int i=1;i<=n;i++){
	    if(!vis[i])idx=i;
	    if(!number[i]) no=i;
	}
	cout<<"! ";
	for(int i=0;i<n;i++)cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define          FaRaBi                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          output                 freopen("output.txt","wt", stdout)
#define          ld                     long double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          ff                     first
#define          ss                     second
#define          pb                     push_back
#define          pf                     printf
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          PI                     acos(-1.0)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Min(v)                 *min_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())
#define          no                     cout << "NO" << endl ;
#define          yes                    cout << "YES" << endl ;
#define          segment_tree           int Lnode = node << 1 , Rnode = Lnode + 1 , mid = ( b + e ) >> 1 ;
#define          siz                    10005

///--------------------**********----------------------------------

vector < int > v, v1, v2, v3, v4 ;
vector < pll > vec ;
vector < ll > adj[ 100005 ] ;
map < ll, ll > Mp ;
set < int > st, st1, st2 ;
stack < ll > Stk ;
multiset < ll > S ;

///---------------------**********--------------------------------

int n, r ;
int arr[ siz ] ;

void Reset()
{
    memset( arr, -1, sizeof arr ) ;
}

void Input()
{
    cin >> n ;
    for( int i = 1 ; i <= n ; i ++ ) st.insert( i ) ;
}

int query( int x, int y )
{
    cout << "? " << x << " " << y << endl;
    cin >> r ;
    return r ;
}

void Calculation()
{
    int p = 1 ;
    for( int i = 1 ; i <= n ; i ++ )
    {
        for( int j = 2 ; j <= n ; j ++)
        {
            if( arr[ j ] == -1 )
            {
                int a = query( p, j ) ;
                int b = query( j, p ) ;
                st.erase( max( a, b ) ) ;
                if( b > a )
                {
                    p = j ;
                    arr[ p ] = b ;
                }
                else
                {
                    arr[ p ] = a ;
                }
                break ;
            }
        }
    }

    for( int i = 1 ; i <= n ; i ++ ) if( arr[ i ] == -1 ) arr[ i ] = *st.begin() ;

    cout << "! ";
    for( int i = 0 ; i < n ; i ++ ) cout << arr[ i ] << " " ;
    cout << endl ;
}

void solve()
{
    Reset() ;
    Input() ;
    Calculation() ;
}

int main()
{
    FaRaBi ;
    int t ;
    //cin >> t ;
    t = 1 ;
    while( t-- ) solve() ;
    return 0 ;
}


#include<bits/stdc++.h>
using namespace std;

#define          FaRaBi                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          output                 freopen("output.txt","wt", stdout)
#define          ld                     long double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          ff                     first
#define          ss                     second
#define          pb                     push_back
#define          pf                     printf
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          PI                     acos(-1.0)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Min(v)                 *min_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())
#define          no                     cout << "NO" << endl ;
#define          yes                    cout << "YES" << endl ;
#define          segment_tree           int Lnode = node << 1 , Rnode = Lnode + 1 , mid = ( b + e ) >> 1 ;
#define          siz                    10005

///--------------------**********----------------------------------

vector < int > v, v1, v2, v3, v4 ;
vector < pll > vec ;
vector < ll > adj[ 100005 ] ;
map < ll, ll > Mp ;
set < int > st, st1, st2 ;
stack < ll > Stk ;
multiset < ll > S ;

///---------------------**********--------------------------------

int n, r ;
int arr[ siz ] ;

void Reset()
{
    memset( arr, -1, sizeof arr ) ;
}

void Input()
{
    cin >> n ;
    for( int i = 1 ; i <= n ; i ++ ) st.insert( i ) ;
}

int query( int x, int y )
{
    cout << "? " << x << " " << y << endl;
    cin >> r ;
    return r ;
}

void Calculation()
{
    int p = 1 ;
    for( int i = 1 ; i <= n ; i ++ )
    {
        for( int j = 1 ; j <= n ; j ++)
        {
            if( arr[ j ] == -1 )
            {
                int a = query( p, j ) ;
                int b = query( j, p ) ;
                st.erase( max( a, b ) ) ;
                if( b > a )
                {
                    p = j ;
                    arr[ p ] = b ;
                }
                else
                {
                    arr[ p ] = a ;
                }
            }
        }
    }

    for( int i = 1 ; i <= n ; i ++ ) if( arr[ i ] == -1 ) arr[ i ] = *st.begin() ;

    cout << "! ";
    for( int i = 0 ; i < n ; i ++ ) cout << arr[ i ] << " " ;
    cout << endl ;
}

void solve()
{
    Reset() ;
    Input() ;
    Calculation() ;
}

int main()
{
    FaRaBi ;
    int t ;
    //cin >> t ;
    t = 1 ;
    while( t-- ) solve() ;
    return 0 ;
}


#include<bits/stdc++.h>
using namespace std;

#define          FaRaBi                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          output                 freopen("output.txt","wt", stdout)
#define          ld                     long double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          ff                     first
#define          ss                     second
#define          pb                     push_back
#define          pf                     printf
#define          mp                     make_pair
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          PI                     acos(-1.0)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          Max(v)                 *max_element(all(v))
#define          Min(v)                 *min_element(all(v))
#define          Upper(c,x)             (upper_bound(c.begin(),c.end(),x)-c.begin())
#define          Lower(c,x)             (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          Unique(X)              (X).erase(unique(all(X)),(X).end())
#define          no                     cout << "NO" << endl ;
#define          yes                    cout << "YES" << endl ;
#define          segment_tree           int Lnode = node << 1 , Rnode = Lnode + 1 , mid = ( b + e ) >> 1 ;
#define          siz                    10005

///--------------------**********----------------------------------

vector < int > v( siz ), v1, v2, v3, v4 ;
vector < pll > vec ;
vector < ll > adj[ 100005 ] ;
map < ll, ll > Mp ;
set < int > st, st1, st2 ;
stack < ll > Stk ;
multiset < ll > S ;

///---------------------**********--------------------------------

int n, r ;
int arr[ siz ] ;

void Reset()
{
    memset( arr, -1, sizeof arr ) ;
}

void Input()
{
    scanf("%d", &n ) ;
    for( int i = 1 ; i <= n ; i ++ ) st.insert( i ) ;
}

int query( int x, int y )
{
    printf( "! %d %d\n", x, y ) ;
    scanf( "%d", &r ) ;
    return r ;
}

void Calculation()
{
    int p = 1 ;
    for( int i = 1 ; i <= n ; i ++ )
    {
        for( int j = 1 ; j <= n ; j ++)
        {
            if( arr[ j ] != -1 )
            {
                int a = query( p, j ) ;
                int b = query( j, p ) ;
                st.erase( max( a, b ) ) ;
                if( b > a )
                {
                    p = j ;
                    arr[ p ] = b ;
                }
                else
                {
                    arr[ p ] = a ;
                }
            }
        }
    }

    for( int i = 1 ; i <= n ; i ++ )
    {
        if( arr[ i ] == -1 ) arr[ i ] = *st.begin() ;
    }

    printf( "! " );
    for( int i = 0 ; i < n ; i ++ ) printf( "%d ", arr[ i ] ) ;
}

void solve()
{
    Reset() ;
    Input() ;
    Calculation() ;
}

int main()
{
    FaRaBi ;
    int t ;
    //cin >> t ;
    t = 1 ;
    while( t-- ) solve() ;
    return 0 ;
}