#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long int dx[] = {-1, 1, -1, 0, 0, -1, 1, 1};
long long int dy[] = {-1, -1, 1, -1, 1, 0, 0, 1};
long long int gcd(long long int a, long long int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
bool isPrime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long int modular_expo(long long int x, long long int y, long long int m) {
  long long int ans = 1;
  while (y) {
    if (y & 1) ans = (ans % m * x % m) % m;
    x = (x % m * x % m) % m;
    y /= 2;
  }
  return ans % m;
}
long long int power(long long int x, long long int y) {
  long long int ans = 1;
  while (y) {
    if (y & 1) ans = (ans * x);
    x *= x;
    y /= 2;
  }
  return ans;
}
void solve() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long int primeFactors(long long int n) {
  long long int cnt = 1;
  while (n % 2 == 0) {
    printf("%d ", 2);
    cnt++;
    n = n / 2;
  }
  for (long long int i = 3; i <= sqrt(n); i += 2) {
    while (n % i == 0) {
      cnt++;
      printf("%d ", i);
      n = n / i;
    }
  }
  if (n > 2) cnt++;
  return cnt;
}
long long int check(long long int n) {
  long long int l = 1, h = n, res = h;
  while (l <= h) {
    long long int mid = (l + h) / 2;
    long long int total = ((mid) * (mid + 1)) / 2;
    if (total >= n) {
      res = mid;
      h = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  return res;
}
vector<long long int> lucky;
long long int l, r;
void backtracking(long long int x) {
  if (x > 1e10) return;
  lucky.emplace_back(x);
  backtracking(10 * x + 4);
  backtracking(10 * x + 7);
}
long long int solve(long long int x) {
  if (x == 0) return 0LL;
  long long int res = 0;
  long long int last = 0;
  for (auto a : lucky) {
    long long int r = min(a, x);
    res += (r - last) * a;
    last = r;
  }
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  long long int sum = 0;
  cin >> l >> r;
  backtracking(4);
  backtracking(7);
  sort(lucky.begin(), lucky.end());
  long long int ans = solve(r) - solve(l - 1);
  cout << ans << "\n";
  return 0;
}
