#include <bits/stdc++.h>
using namespace std;
long long all[1200040] = {4, 7};
int main() {
  int S = 2, a, b, s, e;
  for (int i = 0; all[S - 1] < 4444444444LL; ++i) {
    all[S++] = all[i] * 10 + 4;
    all[S++] = all[i] * 10 + 7;
  }
  scanf("%d%d", &a, &b);
  s = lower_bound(all, all + S, a) - all;
  long long r;
  if (b < all[s])
    r = (b - a + 1) * all[s];
  else
    r = (all[s] - a + 1) * all[s];
  int i;
  for (i = s + 1; all[i] <= b; ++i)
    r += (long long)(all[i] - all[i - 1]) * all[i];
  if (b >= all[s] && all[i - 1] != b) r += (long long)(b - all[i - 1]) * all[i];
  printf("%lld", r);
  return 0;
}
