#include <bits/stdc++.h>
using namespace std;
vector<long long> vv;
bool flag = 0;
long long ans;
int l, r;
void solve(long long i) {
  if (i > (long long)1e10) return;
  if (i) vv.push_back(i);
  solve(i * 10 + 4);
  solve(i * 10 + 7);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cin.tie(0);
  solve(0);
  cin >> l >> r;
  sort(vv.begin(), vv.end());
  for (int i = 0; i < vv.size(); i++) {
    if (vv[i] >= l) {
      if (vv[i] >= r) {
        ans += (vv[i] * (r - l + 1));
        break;
      } else
        ans += (vv[i] * (vv[i] - l + 1));
      l = vv[i] + 1;
    }
    if (l > r) break;
  }
  cout << ans << endl;
  return 0;
}
