#include <bits/stdc++.h>
using namespace std;
vector<long long> lucky;
void backtrack(long long x) {
  if (x > 1e10) return;
  lucky.push_back(x);
  backtrack(x * 10 + 4);
  backtrack(x * 10 + 7);
}
int main() {
  long long ans = 0;
  backtrack(0);
  sort(lucky.begin(), lucky.end());
  int a, b;
  cin >> a >> b;
  for (int i = 1; i < (int)lucky.size(); i++) {
    int l, r, m;
    l = a, r = b;
    while (l <= r) {
      m = (l + r) >> 1;
      if (m <= lucky[i]) {
        ans += lucky[i] * (m - l + 1);
        a = m + 1;
        i--;
        break;
      } else {
        r = m - 1;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
