连模拟都写不对了。。。太弱了。。。
#include <cstdio>
#include <cstring>
#include <cmath>
#define ll long long
ll l,r;
ll solve(ll x){//f[1]+...+f[x]
ll res=0;int n=log10(x)+1,a[11];
for(ll i=1,base=1;i<=n;++i,base*=10){//枚举第i位
a[i]=x%(base*10)/base;
for(ll j=1;j<=9;++j){//枚举第i位的数字j的贡献
ll tmp=x/(base*10)*base;
if(j==a[i]) tmp+=x%base+1;
if(j<a[i]) tmp+=base;
res+=j*tmp;
}
}
return res;
}
int main(){
freopen("a.in","r",stdin);
freopen("a.out","w",stdout);
scanf("%I64d%I64d",&l,&r);
printf("%I64d\n",solve(r)-solve(l-1));
return 0;
}