#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, t = 0, e;
  int l, r;
  long long ans = 0;
  vector<string> v;
  string s = "";
  v.push_back("4");
  v.push_back("7");
  for ((i) = 0; (i) < (int)(9); (i)++) {
    e = v.size();
    for (j = t; j < e; j++) {
      s = v[j];
      s += "4";
      v.push_back(s);
      s = v[j];
      s += "7";
      v.push_back(s);
    }
    t = e;
  }
  cin >> l >> r;
  i = 0;
  bool f = false;
  long long b = 0, m = 0;
  while (1) {
    s = v[i];
    b = m;
    m = atoll(s.c_str());
    if (f == true) ans += m * (m - b);
    if (f == false && m >= l) {
      ans += m * (m - l + 1);
      f = true;
    }
    if (m >= r) {
      ans -= m * (m - r);
      break;
    }
    i++;
  }
  cout << ans << endl;
  return 0;
}
