#include <bits/stdc++.h>
using namespace std;
vector<long long> a;
long long l, r, ans;
inline void prebuild(const long long &x) {
  if (x > (1ll << 37)) {
    return;
  }
  a.push_back(x);
  prebuild(x * 10 + 4);
  prebuild(x * 10 + 7);
}
int32_t main() {
  ios_base ::sync_with_stdio(false);
  cin >> l >> r;
  prebuild(4);
  prebuild(7);
  sort(a.begin(), a.end());
  int ind = 0;
  for (; ind < a.size(); ++ind) {
    if (a[ind] >= l) {
      break;
    }
  }
  for (; ind < a.size(); ++ind) {
    if (a[ind] >= r) {
      ans += (r - l + 1) * a[ind];
      break;
    } else {
      ans += (a[ind] - l + 1) * a[ind];
      l = a[ind] + 1;
    }
  }
  cout << ans;
}
