#include <bits/stdc++.h>
using namespace std;
int main() {
  long long v1, v2;
  cin >> v1 >> v2;
  vector<vector<long long> > mp;
  vector<long long> va;
  va.push_back(4);
  va.push_back(7);
  mp.push_back(va);
  for (int i = 0; i < 10; i++) {
    vector<long long> vb;
    for (int j = 0; j < mp[i].size(); j++) {
      vb.push_back(mp[i][j] * 10 + 4);
      vb.push_back(mp[i][j] * 10 + 7);
      va.push_back(mp[i][j] * 10 + 4);
      va.push_back(mp[i][j] * 10 + 7);
    }
    mp.push_back(vb);
  }
  long long sum = 0;
  long long curr = -1;
  int curi = -1;
  for (int i = 0; i < va.size(); i++) {
    if (v1 <= va[i]) {
      curr = va[i];
      curi = i;
      break;
    }
  }
  for (long long ii = v1; ii <= v2 && curi >= 0 && curi < va.size(); ii++) {
    long long temp = va[curi];
    if (va[curi] > v2) {
      temp = v2;
    }
    sum = sum + (va[curi] * (temp - ii + 1));
    if ((curi + 1) < va.size()) {
      ii = va[curi];
      curi++;
    } else
      break;
  }
  cout << sum;
  return 0;
}
