#include <bits/stdc++.h>
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
using namespace std;
string to_string(int a) {
  stringstream ss;
  ss << a;
  string s = ss.str();
  return s;
}
vector<long long> vec;
void func(long long num) {
  if (num >= 1e11) return;
  vec.push_back(num);
  func(num * 10 + 4);
  func(num * 10 + 7);
}
int main() {
  long long l, r, ans = 0;
  cin >> l >> r;
  func(0);
  sort((vec).begin(), (vec).end());
  for (long long i = 0; i < vec.size(); ++i) {
    if (l > r) break;
    if (l <= vec[i]) {
      ans += (min(vec[i], r) - l + 1) * vec[i];
      l = vec[i] + 1;
    }
  }
  cout << ans;
  return 0;
}
