#include <bits/stdc++.h>
using namespace std;
long long int binpowmod(long long int a, long long int b, long long int m) {
  a %= m;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long int binpow(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long int modInverse(long long int n, long long int p) {
  return binpowmod(n, p - 2, p);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t, n, i, f = 0, j, ans = 0, k, a, l, r;
  cin >> l >> r;
  vector<vector<long long int>> ve(10);
  ve[0].push_back(0);
  for (i = 1; i <= 9; ++i) {
    t = binpow(10, i - 1);
    for (j = 0; j < ve[i - 1].size(); ++j) {
      ve[i].push_back(4 * t + ve[i - 1][j]);
    }
    for (j = 0; j < ve[i - 1].size(); ++j) {
      ve[i].push_back(7 * t + ve[i - 1][j]);
    }
  }
  vector<long long int> v;
  long long int m;
  for (i = 1; i <= 9; ++i) {
    for (j = 0; j < ve[i].size(); ++j) v.push_back(ve[i][j]);
  }
  v.push_back(4444444444);
  if (!binary_search(v.begin(), v.end(), l)) {
    m = std::upper_bound(v.begin(), v.end(), l) - v.begin();
    ans += ((v[m] - l + 1) * v[m]);
    if (v[m] >= r) {
      ans -= ((v[m] - r) * v[m]);
      cout << ans;
      return 0;
    }
    l = v[m] + 1;
  } else {
    ans += l;
    l++;
  }
  while (l <= r) {
    m = std::upper_bound(v.begin(), v.end(), l) - v.begin();
    ans += ((v[m] - l + 1) * v[m]);
    if (v[m] > r) {
      ans -= ((v[m] - r) * v[m]);
      cout << ans;
      return 0;
    } else if (v[m] == r) {
      cout << ans;
      return 0;
    }
    l = v[m] + 1;
  }
  cout << ans << endl;
}
