#include <bits/stdc++.h>
using namespace std;
vector<long long> kand;
void generatelucky() {
  set<long long> temp, t2;
  temp.insert(4);
  temp.insert(7);
  long long x = 10;
  for (int i = (1); i < (11); ++i) {
    t2.clear();
    for (typeof((temp).begin()) it = (temp).begin(); it != (temp).end(); it++) {
      t2.insert(4 * x + *it);
      t2.insert(7 * x + *it);
      kand.push_back(*it);
    }
    x *= 10;
    temp.clear();
    for (typeof((t2).begin()) it = (t2).begin(); it != (t2).end(); it++)
      temp.insert(*it);
  }
  sort(kand.begin(), kand.end());
  return;
}
long long next(long long x) {
  int id = 0;
  while (kand[id] < x) id++;
  return kand[id];
}
int main() {
  long long l, r, ans, m, n;
  generatelucky();
  cin >> l >> r;
  ans = 0ll;
  while (l <= r) {
    m = next(l);
    n = min(m, r);
    ans += (n - l + 1) * m;
    l = n + 1;
  }
  cout << ans << "\n";
  return 0;
}
