#include <bits/stdc++.h>
using namespace std;
vector<long long> lucky;
void generate_lucky(long long number) {
  if (number > 4444444444) return;
  lucky.push_back(number);
  generate_lucky(number * 10 + 4);
  generate_lucky(number * 10 + 7);
}
bool is_lucky(long long number) {
  return binary_search(lucky.begin(), lucky.end(), number);
}
long long after(long long number) {
  return *lower_bound(lucky.begin(), lucky.end(), number);
}
long long before(long long number) {
  return *(lower_bound(lucky.begin(), lucky.end(), number) - 1);
}
int main() {
  lucky.push_back(0);
  generate_lucky(4);
  generate_lucky(7);
  sort(lucky.begin(), lucky.end());
  long long L, R;
  cin >> L >> R;
  long long sum = 0;
  for (int i = 0; i < lucky.size(); i++) {
    if (L <= lucky[i] && lucky[i] < R) {
      sum += lucky[i] * (lucky[i] - lucky[i - 1]);
    }
  }
  sum -= after(L) * (L - before(L) - 1);
  sum += after(R) * (R - before(R));
  cout << sum << endl;
  return 0;
}
