#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod = 1e9+7;
const int N = 2e5 + 10;
int main(){
ios :: sync_with_stdio (false);cin .tie (0);cout .tie (0);
#ifdef LOCAL
freopen("input.in","r",stdin);
freopen("output.out","w",stdout);
#endif
//求l~r中k(k>=0&&k<=9)出现的次数
ll l,r,k;
cin>>l>>r>>k;
l--;
ll ans1=0,ans2=0; //ans1表示1~l-1中k出现的次数,ans2表示1~r中k出现的次数
ll i=1; //i==1时表示此时判断的是个位,i==10判断的是十位......
while(r>=i){
ll p=i*10; //p==i*10,(r/p)代表1~r中有多少个(1~9),(10~99),(100~999)这样的段数
ans1+=i*(r/p);
if(r%p>=i*k&&r%p<i*(k+1)){
ans1+=r%p-i*k+1;
}
else if(r%p>=i*(k+1)){
ans1+=i;
}
i*=10;
}
i=1;
while(l>=i){
ll p=i*10;
ans2+=i*(l/p);
if(l%p>=i*k&&l%p<i*(k+1)){
ans2+=l%p-i*k+1;
}
else if(l%p>=i*(k+1)){
ans2+=i;
}
i*=10;
}
if(k==0){ //特判k==0时多计算的0要减去11111......
ll tmp=0;
while(r){
r/=10;
tmp=tmp*10+1;
}
ans1-=tmp;
tmp=0;
while(l){
l/=10;
tmp=tmp*10+1;
}
ans2-=tmp;
}
cout<<ans1-ans2<<endl;
return 0;
}