#include <bits/stdc++.h>
using namespace std;
set<long long> mas;
void rec(long long cur) {
  if (cur > 1e+11) return;
  mas.insert(cur);
  rec(cur * 10 + 4);
  rec(cur * 10 + 7);
}
int main() {
  long long l, r;
  cin >> l >> r;
  rec(4);
  rec(7);
  set<long long>::iterator it = mas.begin();
  while (it != mas.end() && *it < l) {
    it++;
  }
  long long res = 0;
  int fl = 0;
  while (*it <= r) {
    res += (*it - l + 1) * (*it);
    if (*it == r) fl = 1;
    l = *it + 1;
    it++;
  }
  if (fl == 0) {
    res += (r - l + 1) * (*it);
  }
  cout << res;
  return 0;
}
