#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
void lit(long long n) {
  if (n > 10000000000) {
    return;
  }
  v.push_back(n);
  lit(n * 10 + 4);
  lit(n * 10 + 7);
}
int main() {
  long long n, m, sum = 0;
  cin >> n >> m;
  lit(0);
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    if (v[i] >= n && v[i] < m) {
      sum += v[i] * (v[i] - n + 1);
      n = v[i] + 1;
    } else if (v[i] >= m) {
      sum += v[i] * (m - n + 1);
      break;
    }
  }
  cout << sum << endl;
  return 0;
}
