#include <bits/stdc++.h>
using namespace std;
vector<long long> lucky;
void getLucky(long long x) {
  if (x > 1e10) return;
  lucky.push_back(x);
  getLucky((x * 10) + 4);
  getLucky((x * 10) + 7);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  getLucky(0);
  sort(lucky.begin(), lucky.end());
  long long l, r;
  cin >> l >> r;
  long long ans = 0;
  while (l <= r) {
    int index = lower_bound(lucky.begin(), lucky.end(), l) - lucky.begin();
    ans += (min(r, lucky[index]) - l + 1) * lucky[index];
    l = lucky[index] + 1;
  }
  cout << ans << endl;
  return 0;
}
