#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e9;
vector<long long> lucky_nums;
void generate_lucky(long long n) {
  if (n > MAX) return;
  long long n1 = 10 * n + 4;
  lucky_nums.push_back(n1);
  generate_lucky(n1);
  long long n2 = 10 * n + 7;
  lucky_nums.push_back(n2);
  generate_lucky(n2);
}
void solve() {
  generate_lucky(0);
  sort(lucky_nums.begin(), lucky_nums.end());
  long long l, r;
  cin >> l >> r;
  int i =
      lower_bound(lucky_nums.begin(), lucky_nums.end(), l) - lucky_nums.begin();
  long long prev = l, ans = 0;
  while (lucky_nums[i] < r) {
    ans += (lucky_nums[i] - prev + 1) * lucky_nums[i];
    prev = lucky_nums[i] + 1;
    i++;
  }
  ans += (r - prev + 1) * lucky_nums[i];
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
