#include <bits/stdc++.h>
using namespace std;
bool is_lucky_number(int n) {
  if (n <= 0) return false;
  bool is_lucky = true;
  int dig;
  while (n > 0) {
    dig = n % 10;
    n /= 10;
    if (dig != 4 && dig != 7) {
      is_lucky = false;
      break;
    }
  }
  return is_lucky;
}
unsigned long long int next_lucky_number(unsigned long long int n) {
  if (n <= 0) return 4;
  if (is_lucky_number(n)) return n;
  unsigned long long int div = 1;
  unsigned long long int max_div = 1;
  unsigned long long int mod = 10;
  unsigned long long int max_mod = 10;
  unsigned long long int dig;
  while (div <= n) {
    dig = ((n % mod) / div);
    if (dig != 4 && dig != 7) {
      max_div = div;
      max_mod = mod;
    }
    mod *= 10;
    div *= 10;
  }
  dig = (n % max_mod) / max_div;
  div = max_div;
  mod = max_mod;
  if (dig < 4) {
    n = (n / max_mod) * max_mod;
  } else if (dig < 7) {
    n = (n / max_mod) * max_mod;
    n += (7 * div);
    div /= 10;
  } else {
    div *= 10;
    mod *= 10;
    dig = (n % mod) / div;
    while (dig >= 7) {
      div *= 10;
      mod *= 10;
      dig = (n % mod) / div;
    }
    n = (n / mod) * mod;
    if (dig < 4) {
      n += (4 * div);
    } else if (dig < 7) {
      n += (7 * div);
    }
    div /= 10;
  }
  while (div > 0) {
    n += (4 * div);
    div /= 10;
  }
  return n;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int l, r;
  cin >> l >> r;
  unsigned long long int sum = 0;
  unsigned long long int i = l;
  unsigned long long int n;
  while (i <= r) {
    n = next_lucky_number(i);
    if (n > r) {
      sum += ((r - i + 1ULL) * n);
    } else {
      sum += ((n - i + 1ULL) * n);
    }
    i = n + 1;
  }
  cout << sum << "\n";
  cout << std::flush;
  return 0;
}
