#include <bits/stdc++.h>
using namespace std;
int inline ABS(int a) {
  if (a >= 0)
    return a;
  else
    return -a;
}
vector<unsigned long long> lucky;
void init() {
  int i;
  queue<unsigned long long> Q;
  Q.push(4);
  Q.push(7);
  while (!Q.empty()) {
    unsigned long long u = Q.front();
    Q.pop();
    lucky.push_back(u);
    unsigned long long v = u * 10 + 4, w = u * 10 + 7;
    if (v <= 10000000000LL) Q.push(u * 10 + 4);
    if (w <= 10000000000LL) Q.push(u * 10 + 7);
  }
}
unsigned long long int solve(unsigned long long a) {
  int i;
  unsigned long long c = 0;
  unsigned long long sum = 0, s;
  for (i = 0; i < lucky.size(); i++) {
    if (a >= lucky[i]) {
      s = (unsigned long long)lucky[i] * (lucky[i] - c);
      sum += s;
      c = lucky[i];
    } else
      break;
  }
  s = (unsigned long long)lucky[i] * (a - lucky[i - 1]);
  sum += s;
  return sum;
}
int main() {
  lucky.push_back(0);
  init();
  sort(lucky.begin(), lucky.end());
  unsigned long long a, b;
  cin >> a >> b;
  unsigned long long s1, s2;
  s1 = solve(a - 1);
  s2 = solve(b);
  cout << s2 - s1;
  return 0;
}
