#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
void Lucky(long long n) {
  v.push_back(4);
  v.push_back(7);
  int len, pre = 0;
  for (long long i = 10; i <= n; i *= 10) {
    len = v.size();
    for (int j = pre; j < len; j++) {
      long long val = 4 * i + v[j];
      v.push_back(val);
    }
    for (int j = pre; j < len; j++) {
      long long val = 7 * i + v[j];
      v.push_back(val);
    }
    pre = len;
  }
  sort(v.begin(), v.end());
}
map<long long, long long> mp;
void LuckySum(int n) {
  mp[4] = 16;
  for (int i = 1; i < n; i++) {
    mp[v[i]] = mp[v[i - 1]] + v[i] * (v[i] - v[i - 1]);
  }
}
int main() {
  long long l, r;
  cin >> l >> r;
  Lucky(1000000000);
  LuckySum(v.size());
  auto il = lower_bound(v.begin(), v.end(), l);
  auto ir = lower_bound(v.begin(), v.end(), r);
  long long sum1 = mp[*il] - (*il - l + 1) * (*il);
  long long sum2 = mp[*ir] - (*ir - r) * (*ir);
  cout << sum2 - sum1 << endl;
  return 0;
}
