#include <bits/stdc++.h>
using namespace std;
long long mn = 10000000001;
vector<long long> A;
void next(long long f) {
  if (f >= 10000000001) return;
  A.push_back(f);
  next(f * 10 + 4);
  next(f * 10 + 7);
}
int main() {
  int l, r;
  cin >> l >> r;
  long long sum = 0;
  next(0);
  sort(A.begin(), A.end());
  for (long long i = 1; i < A.size(); i++) {
    if (A[i] >= l && A[i] <= r)
      sum += A[i] * (A[i] - l + 1), l = A[i] + 1;
    else if (A[i] >= r) {
      sum += A[i] * (r - (l - 1));
      break;
    }
  }
  cout << sum;
}
