#include <bits/stdc++.h>
using namespace std;
long long a, b;
long long lucky[2000];
long long wynik;
int main(void) {
  lucky[0] = 4LL;
  lucky[1] = 7LL;
  for (int i = 0; lucky[2 * i + 1] < 1000000000LL; i++) {
    lucky[2 * i + 2] = lucky[i] * 10LL + 4LL;
    lucky[2 * i + 3] = lucky[i] * 10LL + 7LL;
  }
  cin >> a >> b;
  int ind = 0;
  while (a > lucky[ind]) ind++;
  for (long long i = a; i <= b;) {
    wynik += (min(lucky[ind], b) - i + 1LL) * lucky[ind];
    i = lucky[ind] + 1LL;
    ind++;
  }
  cout << wynik << endl;
  return 0;
}
