#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
void solve(long long x) {
  if (x > 1e10) return;
  v.push_back(x);
  solve(x * 10 + 4);
  solve(x * 10 + 7);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  solve(4);
  solve(7);
  sort(v.begin(), v.end());
  long long l, r, sum = 0;
  cin >> l >> r;
  long long per = l - 1;
  int pos = lower_bound(v.begin(), v.end(), l) - v.begin();
  for (int i = pos; i < v.size() && per < r; i++) {
    sum += ((min(v[i], r) - per) * v[i]);
    per = v[i];
  }
  cout << sum;
  return 0;
}
