#include <bits/stdc++.h>
using namespace std;
long long next(long long now) {
  long long a[12];
  long long k = log10(now) + 1;
  for (long long i = 0; i < k; i++) {
    a[i] = now % 10;
    now = now / 10;
  }
  if (a[0] == 4) {
    a[0] = 7;
  } else {
    long long f = 0;
    while (f != 1) {
      for (long long i = 0; i < k; i++) {
        if (a[i] == 7)
          a[i] = 4;
        else {
          f = 1;
          a[i] = 7;
          break;
        }
      }
      if (f == 0) {
        a[k] = 4;
        f = 1;
        k++;
      }
    }
  }
  long long p = 1;
  long long s = 0;
  for (long long i = 0; i < k; i++) {
    s = s + p * a[i];
    p = p * 10;
  }
  return s;
}
int main() {
  long long l, r, i, j, k, p, q, s, m;
  while (scanf("%I64d %I64d", &l, &r) == 2) {
    k = log10(l) + 1;
    m = 0;
    p = 1;
    for (i = 0; i < k; i++) {
      m = m + 7 * p;
      p = p * 10;
    }
    if (l > m) {
      q = 0;
      p = 1;
      for (i = 0; i <= k; i++) {
        q = q + 4 * p;
        p = p * 10;
      }
    } else {
      q = 0;
      p = 1;
      for (i = 0; i < k; i++) {
        q = q + 4 * p;
        p = p * 10;
      }
      while (q < l) {
        q = next(q);
      }
    }
    s = q;
    p = l;
    while (q <= r) {
      s = s + (q - p) * q;
      p = q;
      q = next(p);
    }
    if (q > r) {
      s = s + (r - p) * q;
    }
    cout << s << endl;
  }
  return 0;
}
