#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  long long int l, r;
  cin >> l >> r;
  vector<long long int> v;
  v.push_back(4);
  v.push_back(7);
  long long int mult = 10, beg = 0;
  while (v[v.size() - 1] <= 1e9) {
    int lim = v.size();
    for (int i = beg; i < lim; i++) {
      v.push_back(mult * 4 + v[i]);
    }
    for (int i = beg; i < lim; i++) {
      v.push_back(mult * 7 + v[i]);
    }
    mult *= 10;
    beg = lim;
  }
  int thi = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] >= l) {
      thi = i;
      break;
    }
  }
  long long int sum = 0;
  for (int i = l; i < r + 1; i++) {
    if (v[thi] >= i) {
      sum += v[thi];
    } else {
      thi++;
      sum += v[thi];
    }
  }
  cout << sum << endl;
}
