#include <bits/stdc++.h>
using namespace std;
long long unsigned f(int x) {
  long long unsigned ans = 0;
  long long unsigned prev = 0;
  for (int l = 1; l <= 10; ++l) {
    for (int n_ = ((1 << (l))), subset = 0; subset < n_; ++subset) {
      long long unsigned v = 0;
      for (int i = l - 1; i >= 0; --i) {
        if ((1 << (i)) & subset) {
          v = v * 10 + 7;
        } else {
          v = v * 10 + 4;
        }
      }
      ans += v * static_cast<long long>(min<long long>(v, x) - prev);
      prev = v;
      if (v >= x) return ans;
    }
  }
  return ans;
}
int main() {
  int l, r;
  while (cin >> l >> r) {
    cout << f(r) - f(l - 1) << endl;
  }
  return 0;
}
