#include <bits/stdc++.h>
using namespace std;
vector<long long> vec;
long long l, r;
void sol(long long cur, int i) {
  if (i == 11) return;
  vec.push_back(cur);
  sol(cur * 10 + 4, i + 1);
  sol(cur * 10 + 7, i + 1);
}
int main() {
  sol(4, 1);
  sol(7, 1);
  cin >> l >> r;
  sort(vec.begin(), vec.end());
  long long sum = 0;
  long long last = l - 1;
  for (int i = 0; i < vec.size(); i++)
    if (last < r && vec[i] >= l)
      sum += vec[i] * (min(vec[i], r) - last), last = min(vec[i], r);
  cout << sum << endl;
}
