#include <bits/stdc++.h>
using namespace std;
int l, r;
vector<long long> aux[10];
vector<long long> lucky;
void generate() {
  aux[0].push_back(4);
  aux[0].push_back(7);
  for (int i = 1; i <= 9; i++) {
    for (long long k : aux[i - 1]) {
      aux[i].push_back(k * 10 + 4);
      aux[i].push_back(k * 10 + 7);
    }
  }
  for (int i = 0; i <= 9; i++)
    for (long long k : aux[i]) lucky.push_back(k);
}
int main() {
  generate();
  scanf(" %d %d", &l, &r);
  long long ans = 0;
  int p = lower_bound(lucky.begin(), lucky.end(), l) - lucky.begin();
  while (1) {
    if (lucky[p] >= r) {
      ans += (long long)(r - l + 1) * lucky[p];
      break;
    }
    ans += (long long)(lucky[p] - l + 1) * lucky[p];
    l = lucky[p++] + 1;
  }
  cout << ans << endl;
  return 0;
}
