#include <bits/stdc++.h>
using namespace std;
uint64_t l, r, s;
set<uint64_t> S;
void f(uint64_t x) {
  S.insert(x);
  if (x < r) f(x * 10 + 4), f(x * 10 + 7);
}
int main() {
  cin >> l >> r;
  for (f(0); l <= r;) {
    auto it = S.lower_bound(l);
    s += (min(r, *it) - l + 1) * *it;
    l = *it + 1;
  }
  cout << s << '\n';
}
