#include <bits/stdc++.h>
using namespace std;
long long mn, mx, out = 0;
vector<long long> all, lucky;
void gen(string in) {
  if (in.size() && stoll(in) > 1e10) {
    return;
  }
  if (in.size()) {
    all.push_back(stoll(in));
  }
  gen(in + "4");
  gen(in + "7");
}
void set_lucky() {
  sort(all.begin(), all.end());
  for (int i = 0; i < all.size(); i++) {
    if (all[i] >= mn && all[i] <= mx) {
      lucky.push_back(all[i]);
    } else if (all[i] > mx) {
      lucky.push_back(all[i]);
      break;
    }
  }
}
int main() {
  cin >> mn >> mx;
  gen("");
  set_lucky();
  for (int i = 0; i < lucky.size(); i++) {
    if (i == 0) {
      out += (min(lucky[i], mx) - mn + 1) * lucky[i];
    } else if (i == lucky.size() - 1) {
      out += (mx - lucky[i - 1]) * lucky[i];
    } else {
      out += (lucky[i] - lucky[i - 1]) * lucky[i];
    }
  }
  cout << out << endl;
  return 0;
}
