#include #include using namespace std; long long F(int x) { long long ans = 0; long long total = 7000; int inainte = 1; long long sumcif = 0; while(inainte * 1000 <= x) { ans += total + sumcif * 500; int aux = inainte; sumcif = 0; while(aux) { sumcif += aux % 10; aux /= 10; } ++inainte; } for(int i = (inainte - 1) * 1000 + 1; i <= x; i += 2) { int aux = i; sumcif = 0; while(aux) { sumcif += aux % 10; aux /= 10; } ans += sumcif; } return ans; } int main() { #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); #endif // ONLINE_JUDGE int A, B; cin >> A >> B; cout << F(B) - F(A - 1) << '\n'; return 0; }