#include <bits/stdc++.h>
using namespace std;
long long next_lucky(long long k) {
  if (k == 0) return 0;
  long long last = k % 10;
  long long others = k / 10;
  long long others_next = next_lucky(others);
  if (others_next > others) return others_next * 10 + 4;
  if (last <= 4) return others * 10 + 4;
  if (last <= 7) return others * 10 + 7;
  return next_lucky(others + 1) * 10 + 4;
}
long long lucky_sum(long long l, long long r) {
  long long sum = 0;
  while (l <= r) {
    long long nextl = next_lucky(l);
    long long next = min(nextl, r);
    sum += nextl * (next - l + 1);
    l = next + 1;
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long l, r;
  cin >> l >> r;
  cout << lucky_sum(l, r) << endl;
  return 0;
}
