#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000;
const int mod = 1e9 + 7;
const int N = 2 * 1e5 + 10;
const long double eps = 1e-5;
void solve() {
  long long l, r;
  cin >> l >> r;
  vector<long long> vc[10];
  vc[0].push_back(4);
  vc[0].push_back(7);
  for (int i = 0; i <= 8; ++i) {
    vector<long long> tmp;
    for (int j = 0; j < vc[i].size(); ++j)
      tmp.push_back(stoll("4" + to_string(vc[i][j])));
    for (int j = 0; j < vc[i].size(); ++j)
      tmp.push_back(stoll("7" + to_string(vc[i][j])));
    for (int j = 0; j < tmp.size(); ++j) vc[i + 1].push_back(tmp[j]);
  }
  vector<long long> good(1, 0);
  for (auto it : vc) {
    for (auto k : it) good.push_back(k);
  }
  long long ans = 0;
  int pos = 0;
  while (good[pos + 1] < l) ++pos;
  while (good[pos] < r) {
    ans +=
        (min(good[pos + 1], r) - max(l - 1, good[pos])) * 1ll * good[pos + 1];
    ++pos;
  }
  cout << ans << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
