#include <bits/stdc++.h>
using namespace std;
long long int makeitnumber(long long int a[], long long int k) {
  long long int sum = 0;
  long long int b = 1, i;
  for (i = 1; i <= k; i++) {
    sum = sum + (b * a[i]);
    b = b * 10;
  }
  return sum;
}
int main() {
  long long int l, r, i, j, k, s, x, y, sum = 0, prev;
  scanf("%lld %lld", &l, &r);
  vector<long long int> v;
  v.push_back(4);
  v.push_back(7);
  long long int a[12] = {0};
  a[1] = 7;
  k = 1;
  for (i = 2; v[i - 1] != 777777777; i++) {
    s = 1;
    while (a[s] != 4 && s <= k) {
      s++;
    }
    if (s > k) {
      k = k + 1;
      for (j = 1; j <= k; j++) {
        a[j] = 4;
      }
    } else {
      a[s] = 7;
      for (j = 1; j < s; j++) {
        a[j] = 4;
      }
    }
    x = makeitnumber(a, k);
    v.push_back(x);
  }
  v.push_back(4444444444);
  for (i = 0; i < 1023; i++) {
    if (v[i] >= l) {
      x = i;
      break;
    }
  }
  for (i = 0; i < 1023; i++) {
    if (v[i] >= r) {
      y = i;
      break;
    }
  }
  prev = l;
  for (i = x; i <= y; i++) {
    if (i == y) {
      sum = sum + ((r - prev + 1) * v[i]);
      break;
    }
    sum = sum + ((v[i] - prev + 1) * v[i]);
    prev = v[i] + 1;
  }
  printf("%lld", sum);
  return 0;
}
