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