#include <bits/stdc++.h>
using namespace std;
const int N = 100500;
vector<long long> a;
void go(long long x) {
  if (x > 1e10) return;
  a.push_back(x);
  go(x * 10 + 4);
  go(x * 10 + 7);
}
int main() {
  srand(time(NULL));
  long long l, r;
  cin >> l >> r;
  go(4LL);
  go(7LL);
  sort(a.begin(), a.end());
  long long last = l - 1;
  long long ans = 0;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] > last) {
      ans += (min(a[i], r) - last) * a[i];
      last = a[i];
    }
    if (a[i] > r) break;
  }
  cout << ans;
  return 0;
}
