#include <bits/stdc++.h>
using namespace std;
long long lucky[100005];
long long d[40];
int main() {
  d[0] = 1;
  for (int i = 1; i < 20; i++) {
    d[i] = 2 * d[i - 1];
  }
  int k = 0;
  long long l, r;
  cin >> l >> r;
  int s;
  int e;
  bool b = false;
  for (long long y = 1; y <= 10; y++) {
    for (long long i = 0; i < d[y]; i++) {
      long long temp = i;
      long long num = 0;
      for (long long j = 0; j < y; j++) {
        if (temp % 2 == 0) {
          num = 10 * num + 4;
        } else {
          num = 10 * num + 7;
        }
        temp = temp / 2;
      }
      lucky[k] = num;
      k++;
    }
  }
  sort(lucky, lucky + k - 1);
  for (int i = 0; i < k; i++) {
    if (!b && lucky[i] >= l) {
      s = i;
      b = !b;
    }
    if (lucky[i] >= r) {
      e = i;
      break;
    }
  }
  long long sum = 0;
  for (long long i = s + 1; i < e; i++) {
    sum = sum + (lucky[i] - lucky[i - 1]) * lucky[i];
  }
  sum = sum + (r - lucky[e - 1]) * lucky[e] + (lucky[s] - l + 1) * lucky[s];
  if (lucky[s] == lucky[e])
    cout << lucky[s] * (r - l + 1);
  else
    cout << sum << endl;
}
