#include <bits/stdc++.h>
using namespace std;
template <class T>
T chmin(T& a, T& b) {
  if (a > b) return a;
}
template <class T>
T chmax(T& a, T& b) {
  if (a < b) return b;
}
const long long INF = 1e18;
const int MOD = 3;
const int N = 7000;
bool v[N];
vector<long long> adj[N];
int main() {
  long long l, r;
  cin >> l >> r;
  vector<long long> v;
  v.push_back(0);
  v.push_back(4);
  v.push_back(7);
  long long cnt = 1;
  while (cnt != 10) {
    for (int i = v.size() - pow(2, cnt), j = v.size(); i < j; i++) {
      v.push_back(4 * pow(10, cnt) + v[i]);
      v.push_back(7 * pow(10, cnt) + v[i]);
    }
    cnt++;
  }
  sort(v.begin(), v.end());
  long long lo, up;
  for (int i = 0; v[i] < l; i++) lo = i;
  for (int i = v.size() - 1; v[i] >= r; i--) up = i;
  lo++;
  unsigned long long ans = 0;
  ans += v[lo] * (min(v[lo] - l + 1, r - l + 1));
  for (int i = lo + 1; i <= up; i++) {
    ans += (v[i] * (min(min(r, v[i]) - v[i - 1], r - l)));
  }
  cout << ans;
}
