#include <bits/stdc++.h>
using namespace std;
int a[10005];
int main() {
  int l, r, i;
  vector<long long> ans;
  scanf("%d%d", &l, &r);
  long long total = 0;
  queue<long long> q;
  q.push(4);
  q.push(7);
  long long hi = 10000000000;
  while (!q.empty()) {
    long long cur = q.front();
    q.pop();
    if (cur <= hi) {
      ans.push_back(cur);
      q.push(cur * 10 + 4);
      q.push(cur * 10 + 7);
    }
  }
  sort(ans.begin(), ans.end());
  long long pr = 0;
  if (pr < l) pr = l;
  for (i = 0; i < ans.size(); i++) {
    if (ans[i] >= pr) {
      if (pr > r) break;
      long long li = ans[i];
      if (li > r) li = r;
      long long cur = li - pr + 1;
      total += cur * ans[i];
      if (ans[i] > r) break;
      pr = ans[i] + 1;
    }
    if (ans[i] > r) break;
  }
  cout << total;
  return 0;
}
