#include <bits/stdc++.h>
using namespace std;
const long long M = 1e10;
set<long long> s;
void bt(long long x) {
  if (x >= M) return;
  s.insert(x);
  bt(x * 10 + 4);
  bt(x * 10 + 7);
}
int main() {
  bt(0);
  int l, r;
  cin >> l >> r;
  long long c = 0;
  for (set<long long>::iterator it = s.begin(); it != s.end(); it++) {
    if (*it >= l) {
      if (r <= *it) {
        c += (r - l + 1) * *it;
        break;
      } else
        c += (*it - l + 1) * *it;
      l = *it + 1;
    }
  }
  cout << c << endl;
  return 0;
}
