#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int l, r;
  cin >> l >> r;
  queue<long long int> Q;
  Q.push(4);
  Q.push(7);
  vector<long long int> arr;
  while (!Q.empty()) {
    long long int c = Q.front();
    Q.pop();
    arr.push_back(c);
    if (c >= r) break;
    long long int val1 = (c * 10) + 4;
    long long int val2 = (c * 10) + 7;
    Q.push(val1);
    Q.push(val2);
  }
  int i = 0;
  while (l > arr[i]) ++i;
  long long int out = 0;
  while (i < arr.size() && l <= r) {
    out += ((min(r, arr[i]) + 1) - l) * arr[i];
    l = arr[i] + 1;
    ++i;
  }
  cout << out << endl;
  return 0;
}
