#include //#define fin cin //#define fout cout #define F first #define S second using namespace std; typedef long long ll; ll p10[20] , a , b; ll f(ll x) { if (x == 0) return 0; ll z , y , i , cf , j , ret = 0; ll v[20]; v[0] = 0; while (x) v[++v[0]] = x % 10, x /= 10; reverse(v + 1 , v + v[0] + 1); z = 0; for (i = 1; i <= v[0]; ++i) { y = 0; for (j = i + 1; j <= v[0]; ++j) y = y * 10 + v[j]; for (cf = 1; cf < 10; ++cf) { ll nr = z; if (i < v[0]) nr *= 1LL * p10[v[0]-i-1] * 5; else nr *= 1LL * (cf & 1); if (i == v[0] && cf % 2 == 0) continue; if (cf <= v[i]) if (i < v[0]) if (cf == v[i]) nr += (y + 1) / 2; else nr += 1LL * p10[v[0]-i-1] * 5; else nr++; ret += 1LL * cf * nr; } z = z * 10 + v[i]; } return ret; } int main() { #ifndef ONLINE_JUDGE freopen("input.in","r",stdin); freopen("output.out","w",stdout); #endif // ONLINE_JUDGE /* #ifndef ONLINE_JUDGE ifstream fin("input.in"); ofstream fout("output.out"); #endif // ONLINE_JUDGE */ p10[0] = 1; for (int i = 1; i <= 10; ++i) p10[i] = 1LL * p10[i-1] * 10; scanf("%lld %lld", &a, &b); printf("%lld\n", f(b) - f(a - 1)); return 0; }