#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
inline T LCM(T a, T b) {
  if (a < 0) return LCM(-a, b);
  if (b < 0) return LCM(a, -b);
  return a * (b / gcd(a, b));
}
long long int p(int a) {
  long long int i = 1;
  for (int j = 0; j < a; j++) i = i * 2;
  return i;
}
int main() {
  long long int l, r;
  cin >> l >> r;
  vector<long long int> all;
  long long ans = 0, num;
  for (int i = 1; i <= 11; i++) {
    long long int mx = p(i);
    for (long long int j = 0; j < mx; j++) {
      num = 0;
      for (int k = 0; k < i; k++) {
        num = num * 10;
        if ((j & (1 << k)) > 0) {
          num += 7;
        } else
          num += 4;
      }
      all.push_back(num);
    }
  }
  sort(all.begin(), all.end());
  long long int l1 = l - 1;
  for (int i = 0; i < all.size(); i++) {
    if (all[i] >= l) {
      ans = ans + all[i] * max(0ll, min((r - l1) * 1ll, (all[i] - l1)));
      l1 = all[i];
      if (r <= l1) break;
    }
  }
  cout << ans;
  return 0;
}
