#include <bits/stdc++.h>
using namespace std;
vector<long long int> s;
void luckyNumberGenerator(long long int num) {
  if (num > 100000000000) {
    return;
  }
  s.push_back(num);
  luckyNumberGenerator(num * 10 + 4);
  luckyNumberGenerator(num * 10 + 7);
}
int main() {
  luckyNumberGenerator(4);
  luckyNumberGenerator(7);
  long long int low, high;
  cin >> low >> high;
  sort(s.begin(), s.end());
  long long int sum = 0;
  for (long long int i = 0; i < s.size(); i++) {
    if (s[i] >= low && s[i] <= high) {
      sum += (s[i] - low + 1) * s[i];
      low = s[i] + 1;
    } else if (s[i] >= low && s[i] > high) {
      sum += (high - low + 1) * s[i];
      break;
    }
  }
  cout << sum << "\n";
  return 0;
}
