#include <bits/stdc++.h>
using namespace std;
int main() {
  long long l, r;
  cin >> l >> r;
  long long dem = 0;
  for (long long i = 0; l <= r; i++) {
    long long n = 0, p = 1, j = i;
    while (j >= 0) {
      if ((j & 1) == 1) {
        n += (p * 7);
      } else {
        n += (p * 4);
      }
      p *= 10;
      j = j / 2 - 1;
    }
    if (n >= l) {
      dem += (min(n, r) - l + 1LL) * n;
      l = n + 1;
    }
  }
  cout << dem;
  return 0;
}
