#include <bits/stdc++.h>
using namespace std;
vector<long long> lucky;
void findLucky(int n) {
  queue<long long> q;
  while (!q.empty()) q.pop();
  q.push(0);
  while (!q.empty()) {
    long long f = q.front();
    q.pop();
    long long a[2] = {f * 10 + 4, f * 10 + 7};
    for (int i = 0; i < 2; i++)
      if (a[i] < n) {
        q.push(a[i]);
        lucky.push_back(a[i]);
      } else {
        lucky.push_back(a[i]);
        return;
      }
  }
}
int main() {
  long long l, r;
  cin >> l >> r;
  long long sum = 0;
  findLucky(r);
  for (int i = 0; i < lucky.size(); i++)
    if (lucky[i] >= l)
      sum += (min(r, lucky[i]) - max(l, (i > 0) ? lucky[i - 1] + 1 : 0) + 1) *
             lucky[i];
  cout << sum << endl;
}
