#include <bits/stdc++.h>
using namespace std;
long long getLeast(long long num, long long n) {
  if (num > 1000000000 && num >= n) return num;
  if (num >= n)
    return min(num,
               min(getLeast((num * 10) + 4, n), getLeast((num * 10) + 7, n)));
  return min(getLeast((num * 10) + 4, n), getLeast((num * 10) + 7, n));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long l, r, s = 0, luck = 0;
  cin >> l >> r;
  for (; l <= r;) {
    luck = getLeast(0, l);
    s += luck * (min(luck - l, r - l) + 1);
    l += (min(luck - l, r - l) + 1);
  }
  cout << s;
}
