#include <bits/stdc++.h>
using namespace std;
long long x[1515];
int c = -1;
void dfs(long long p) {
  long long w1 = p * 10 + 4, w2 = p * 10 + 7;
  if (w1 > 1000000000 || w2 > 1000000000) return;
  x[++c] = w1;
  x[++c] = w2;
  dfs(w1);
  dfs(w2);
}
int main() {
  dfs(0);
  x[++c] = 4444444444;
  sort(x, x + c + 1);
  long long n, m;
  cin >> n >> m;
  long long s = 0;
  long long w = n - 1;
  for (int i = 0; i <= c; ++i) {
    if (x[i] >= n) {
      s += (min(x[i], m) - w) * x[i];
      w = x[i];
      if (x[i] >= m) break;
    }
  }
  cout << s << endl;
  return 0;
}
