#include <bits/stdc++.h>
using namespace std;
vector<long long> vec;
long long l, r;
void hope(long long x) {
  if (x > 10000000000) return;
  if (x >= l) vec.push_back(x);
  hope(x * 10 + 4);
  hope(x * 10 + 7);
}
void think() {
  cin >> l >> r;
  hope(0);
  long long ans = 0;
  sort(vec.begin(), vec.end());
  for (long long i = 0; i < vec.size(); i++) {
    ans += vec[i] * (min(vec[i], r) - l + 1);
    l = vec[i] + 1;
    if (l > r) break;
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long testcase = 1;
  while (testcase--) {
    think();
  }
  return 0;
}
