#include <bits/stdc++.h>
using namespace std;
void input(long &n) { scanf("%ld", &n); }
void output(long n) { printf("%ld", n); }
void build(long long lucky[], long &cnt, long digits, long curdigit,
           long curpower, long &curnumber) {
  if (curdigit > digits)
    lucky[cnt++] = curnumber;
  else {
    curnumber += 4 * curpower;
    build(lucky, cnt, digits, curdigit + 1, curpower * 10, curnumber);
    curnumber += 3 * curpower;
    build(lucky, cnt, digits, curdigit + 1, curpower * 10, curnumber);
    curnumber -= 7 * curpower;
  }
}
void init(long long lucky[], long &cnt) {
  for (long i = 1; i <= 9; i++) {
    long tmp = 0;
    build(lucky, cnt, i, 1, 1, tmp);
  }
  lucky[cnt++] = 4444444444LL;
}
long search(long val, long long a[], long l, long r) {
  for (long i = l; i <= r; i++) {
    if (a[i] >= val) return i;
  }
  return -1;
}
long long sum(long l, long r) {
  long long tmp2 = (r - l + 1);
  return tmp2;
}
long long solve(long cnt, long long a[], long l, long r) {
  sort(a, a + cnt);
  long id1 = search(l, a, 0, cnt - 1);
  long id2 = search(r, a, 0, cnt - 1);
  long long res = 0;
  res += sum(l, a[id1]) * a[id1];
  res -= sum(r + 1, a[id2]) * a[id2];
  for (long i = id1 + 1; i <= id2; i++) {
    res += sum(a[i - 1] + 1, a[i]) * a[i];
  }
  return res;
}
long long a[2000 + 1];
long cnt, l, r;
int main() {
  init(a, cnt);
  input(l);
  input(r);
  long long res = solve(cnt, a, l, r);
  cout << res;
}
