#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
const double EPS = 1e-7;
const int INF = 1000000000 + 5;
const int MAXN2 = 3000 + 5;
char s[MAXN];
unsigned long long get_value(int len) {
  unsigned long long ans = 0;
  for (int i = len - 1; i >= 0; i--) {
    ans *= 10;
    ans += s[i] - '0';
  }
  return ans;
}
int getNext(int len) {
  for (int i = 0; i < len; i++) {
    if (s[i] == '4') {
      s[i] = '7';
      for (int j = 0; j < i; j++) s[j] = '4';
      return len;
    }
  }
  for (int i = 0; i < len; i++) s[i] = '4';
  s[len] = '4';
  len++;
  return len;
}
unsigned long long calc(unsigned long long r) {
  unsigned long long ans = 0;
  int len = getNext(0);
  unsigned long long v = get_value(len);
  unsigned long long last = 0;
  while (v < r) {
    ans += (v - last) * v;
    last = v;
    len = getNext(len);
    v = get_value(len);
  }
  ans += (r - last) * v;
  return ans;
}
int main() {
  int l, r;
  scanf("%d%d", &l, &r);
  unsigned long long s1 = calc(r);
  unsigned long long s2 = calc(l - 1);
  unsigned long long s = s1 - s2;
  cout << s;
  return 0;
}
