#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 1;
  while (t--) {
    long long l, r, i, sum = 0;
    deque<long long> a;
    a.push_back(4);
    a.push_back(7);
    cin >> l >> r;
    for (i = l; i <= r;) {
      if (i <= a.front()) {
        sum += a.front();
        i++;
      } else {
        a.push_back(a.front() * 10 + 4);
        a.push_back(a.front() * 10 + 7);
        a.pop_front();
      }
    }
    cout << sum << " ";
  }
  return 0;
}
