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