#include <bits/stdc++.h>
using namespace std;
vector<long long> comb;
vector<long long> fin;
void fill(vector<long long> tmp, int ind) {
  if (ind == 10LL) {
    long long num = 0LL;
    for (long long i = 0LL; i < 10LL; ++i) {
      if (tmp[i] != 0LL) num = (num * 10LL) + tmp[i];
    }
    if (num != 0LL) comb.push_back(num);
  } else {
    vector<long long> temp = tmp;
    temp.push_back(0LL);
    fill(temp, ind + 1);
    temp[ind] = 4LL;
    fill(temp, ind + 1);
    temp[ind] = 7LL;
    fill(temp, ind + 1);
  }
}
bool lucky(long long n) {
  if (n <= 0) return 0;
  while (n > 0) {
    if (n % 10 != 4 && n % 10 != 7) return 0;
    n /= 10;
  }
  return 1;
}
int main() {
  int l, r;
  scanf("%d %d", &l, &r);
  vector<long long> tmp;
  fill(tmp, 0);
  sort(comb.begin(), comb.end());
  for (long long i = 0; i < comb.size(); ++i) {
    if (lucky(comb[i])) fin.push_back(comb[i]);
  }
  comb.resize(unique(fin.begin(), fin.end()) - fin.begin());
  int lol = -1, lor = -1;
  for (int i = 0; i < fin.size(); ++i) {
    if (l <= fin[i]) {
      lol = i;
      break;
    }
  }
  for (int i = 0; i < fin.size(); ++i) {
    if (r <= fin[i]) {
      lor = i;
      break;
    }
  }
  if (lol == lor) {
    long long res = 0LL;
    res = ((r - l) + 1) * (fin[lol]);
    cout << res << endl;
  } else {
    long long res = 0LL;
    if (fin[lol] >= l)
      res += ((long long)((fin[lol] - l) + 1)) * ((long long)fin[lol]);
    for (long long i = lol; i < lor; ++i) {
      if (fin[i + 1] <= r)
        res += ((long long)((fin[i + 1] - fin[i]))) * ((long long)fin[i + 1]);
      else
        break;
    }
    if (fin[lor] > r)
      res += ((long long)((r - fin[lor - 1]))) * ((long long)fin[lor]);
    cout << res << endl;
  }
  return 0;
}
