#include <bits/stdc++.h>
using namespace std;
const int MAX = 11;
int cnt(long long num) {
  int total = 0;
  while (num && ++total) num /= 10;
  return total;
}
vector<long long> ans;
void makeComb(long long num) {
  if (cnt(num) == MAX) return;
  ans.push_back(num);
  makeComb(num * 10 + 4);
  makeComb(num * 10 + 7);
}
int main() {
  makeComb(0);
  sort(ans.begin(), ans.end());
  int l, r;
  cin >> l >> r;
  unsigned long long total = 0;
  long long cur = l;
  bool first = true;
  for (int i = 0; i < ans.size(); i++) {
    if (ans[i] < l) {
      continue;
    } else if (ans[i] >= r) {
      total += ans[i] * (min(ans[i], r * 1LL) - cur + (first));
      break;
    } else if (ans[i] >= l && ans[i] < r) {
      total += ans[i] * (ans[i] - cur + (first));
      cur = ans[i];
      first = false;
    }
  }
  cout << total << endl;
  return 0;
}
