#include <iostream>
using namespace std;
long long p;
long long a[];
long long solve(long long n){
long long left,m,sum =;
for(int i=;i<;i++){
left = n/a[i]-;
sum += left*a[i-];
m = (n%a[i]-n%a[i-])/a[i-];
if(m>) sum += a[i-];
else if(m==) sum += n%a[i-]+;
if(n<a[i]) break;
}
return sum;
}
int main()
{
a[] =;
for(int i=;i<;i++)
a[i] =a[i-]*;
long long m,n;
while(cin>>m>>n){
if(m<)
break;
if(n==){
cout<<<<endl;
continue;
}
long long res1 = solve(n);
long long res2 = solve(m-);
//cout<<p<<endl;
//cout<<res1<<" "<<res2<<endl;
cout<<res1-res2<<endl;
}
return ;
}
/**
if(n<0)
return 0;
long long low;
long long high;
long long cur;
p =1;
int tmp=0;
long long cnt =0;
while(n/p!=0){
tmp ++;
low = n-(n/p)*p;
high = n/(p*10)-1;
cur = (n/p)%10;
switch (cur){
case 0:
cnt += high*p+low+1;
break;
default:
cnt += (high+1)*p;
break;
}
p =p*10;
}
//for(int i=0;i<tmp;i++){
// cnt -= a[i];
//}
return cnt;
*/