#include <bits/stdc++.h>
using namespace std;
long long ans, l, r, j, cn, ii, ix, p, N = 4e3;
vector<long long> A;
long long pww(long long a, long long b) {
  long long r = 1;
  for (long long i = 1; i <= b; i++) r *= a;
  return r;
}
void gen(long long i, long long p) {
  long long r = 0;
  for (long long k = 0; k < p; k++) {
    if (i & (1 << k))
      r += pww(10, k) * 7;
    else
      r += pww(10, k) * 4;
  }
  A.push_back(r);
}
int main() {
  cin >> l >> r;
  while (cn < N) {
    ii += 1;
    long long pw = pow(2, ii);
    for (long long a = 0; a < pw; a++) {
      gen(a, ii);
    }
    cn += pw;
  }
  p = l;
  while (A[j] < l) j++;
  ix = j;
  for (ix = j; A[ix] <= r; ix++) {
    ans += A[ix] * (A[ix] - p + (ix == j ? 1 : 0));
    p = A[ix];
  }
  ans += A[ix] * (r - p + (ix == j ? 1 : 0));
  cout << ans << endl;
  return 0;
}
