#include <bits/stdc++.h>
const long long mxn = 1e6 + 7;
const long long mod = 1e9 + 9;
const long long inf = 1e18 + 9;
using namespace std;
vector<long long> v;
long long l, r, sum = 0;
void gen(long long x) {
  if (x >= 10000000000) return;
  v.push_back(x);
  gen(x * 10 + 4);
  gen(x * 10 + 7);
  return;
}
int main() {
  gen(4);
  gen(7);
  cin >> l >> r;
  sort(v.begin(), v.end());
  for (int i = l; i <= r; i++) {
    long long x = *lower_bound(v.begin(), v.end(), i);
    sum += x;
    long long dist = min(x, r) - i;
    sum += (dist * x);
    i += dist;
  }
  cout << sum;
  return 0;
}
