#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
void go(long long n) {
  if (n < (long long)10000000000)
    v.push_back(n);
  else
    return;
  go(n * 10 + 4);
  go(n * 10 + 7);
}
int main() {
  long long l, r, res = 0;
  cin >> l >> r;
  go(0);
  int L = v.size();
  sort(v.begin(), v.end());
  int j = 0;
  while (l <= r) {
    while (v[j] < l) ++j;
    if (v[j] <= r)
      res += (v[j] - l + 1) * v[j];
    else
      res += (r - l + 1) * v[j];
    l = v[j] + 1;
  }
  cout << res << endl;
  return 0;
}
