#include <bits/stdc++.h>
using namespace std;
string st = "";
vector<long long> lucky_digit;
void generat(long long n) {
  if (n >= 10) return;
  st = st + '4';
  lucky_digit.push_back(stoll(st));
  generat(n + 1);
  st.pop_back();
  st = st + '7';
  lucky_digit.push_back(stoll(st));
  generat(n + 1);
  st.pop_back();
}
int main() {
  long long i, j, k, l, m, n, r;
  cin >> l >> r;
  generat(0);
  long long sum = 0;
  sort(lucky_digit.begin(), lucky_digit.end());
  auto it = lower_bound(lucky_digit.begin(), lucky_digit.end(), l);
  for (long long x = l; x <= r; it++) {
    sum += (min((*it - x + 1), (r - x + 1)) * (*it));
    x = *it + 1;
  }
  cout << sum << endl;
}
