#include <bits/stdc++.h>
using namespace std;
int n, m;
long long i, j, k, l, r, x;
long long a[11111];
int d;
long long s;
void gen(long long x) {
  if (x > 8e10) return;
  if (x) a[d++] = x;
  gen(x * 10 + 4);
  gen(x * 10 + 7);
}
int main() {
  d = 0;
  gen(0);
  sort(a, a + d);
  cin >> l >> r;
  s = 0;
  k = l;
  i = 0;
  for (; k <= r;) {
    while (a[i] < k) ++i;
    x = ((a[i]) < (r) ? (a[i]) : (r));
    s += (x - k + 1) * a[i];
    k = a[i] + 1;
  }
  cout << s << endl;
  return 0;
}
