#include <bits/stdc++.h>
using namespace std;
set<long long> lucky;
void generate_lucky(long long x) {
  if (x > 1e10) return;
  lucky.insert(x);
  generate_lucky(x * 10 + 4);
  generate_lucky(x * 10 + 7);
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int l, r;
  cin >> l >> r;
  generate_lucky(0);
  lucky.erase(lucky.begin());
  long long ans = 0;
  set<long long>::iterator it = lucky.lower_bound(l);
  if (l == r) {
    ans = *it;
  } else {
    if (r > *it) {
      ans += *it * (*it - l + 1);
      l = *it;
      ++it;
      while (*it < r) {
        ans += *it * (*it - l);
        l = *it;
        ++it;
      }
      ans += *it * (r - l);
    } else {
      ans = (r - l + 1) * *it;
    }
  }
  cout << ans << '\n';
  return 0;
}
