#include <bits/stdc++.h>
using namespace std;
void fastInOut() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
}
int dx[] = {0, 0, 1, -1, -1, -1, 1, 1};
int dy[] = {1, -1, 0, 0, -1, 1, -1, 1};
vector<string> lucky;
vector<long long> nums;
long long stringtoint(string s) {
  istringstream buffer(s);
  long long value;
  buffer >> value;
  return value;
}
void solve(string s) {
  if (s.size() == 11) return;
  if (s != "") lucky.push_back(s);
  solve(s + "4");
  solve(s + "7");
}
int main() {
  solve("");
  for (int i = 0; i < lucky.size(); i++) nums.push_back(stringtoint(lucky[i]));
  sort(nums.begin(), nums.end());
  long long l, r, last, sum = 0;
  cin >> l >> r;
  last = l;
  for (int i = 0; i < nums.size(); i++) {
    if (last >= r && last != l) break;
    long long x = nums[i];
    if (x < l) continue;
    if (x <= r) {
      if (sum == 0) last--;
      sum += (x - last) * x;
      last = x;
    } else {
      if (sum == 0) last--;
      sum += (r - last) * x;
      last = x;
    }
  }
  cout << sum;
}
