#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool fs(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c < '0' || c > '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
vector<long long int> v;
void fun(long long int n) {
  if (n > 10000000000) return;
  if (n) v.push_back(n);
  fun(n * 10 + 4);
  fun(n * 10 + 7);
}
int main() {
  long long int l, r, x, sum = 0, d = 0;
  cin >> l >> r;
  fun(0);
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    if (v[i] >= l) {
      d = i;
      break;
    }
  }
  while (l <= r) {
    x = v[d] - l + 1;
    if (x + l > r) x = r - l + 1;
    sum += (x * v[d]);
    d++;
    l += x;
  }
  cout << sum << endl;
  return 0;
}
