#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
long long Next(long long x) {
  long long i = 0;
  for (; x > v[i]; i++)
    ;
  return i;
}
int main() {
  set<int> st;
  st.clear();
  v.clear();
  v.push_back(4);
  v.push_back(7);
  int ind = 4;
  long long int maxi = 0;
  for (int i = 0; maxi <= 1000000000; i++) {
    maxi = v[i] * 10 + 4;
    v.push_back(maxi);
    if (maxi > 1000000000) break;
    maxi = v[i] * 10 + 7;
    v.push_back(maxi);
  }
  int N;
  int size = v.size();
  long long l, r;
  long long mx = 4444444444;
  while (cin >> l >> r) {
    long long ans = 0;
    long long nl, nr;
    nl = Next(l);
    nr = Next(r);
    while (nl != nr) {
      ans += v[nl] * (1 + v[nl] - l);
      l = v[nl] + 1;
      nl++;
    }
    ans += v[nr] * (1 + r - l);
    cout << ans << endl;
  }
  return 0;
}
