#include <bits/stdc++.h>
using namespace std;
long long a[100005];
int m = 0;
void dfs(long long x, int step) {
  if (step > 10) {
    return;
  }
  a[m++] = x;
  dfs(x * 10 + 4, step + 1);
  dfs(x * 10 + 7, step + 1);
}
long long sum(long long x) {
  long long sum = 0;
  if (x == 0) {
    return 0;
  }
  for (int i = 0; i < m; i++) {
    if (x >= a[i]) {
      sum += a[i] * (a[i] - a[i - 1]);
    } else {
      sum += a[i] * (x - a[i - 1]);
      break;
    }
  }
  return sum;
}
int main() {
  dfs(4, 0);
  dfs(7, 0);
  sort(a, a + m);
  long long l, r;
  cin >> l >> r;
  cout << sum(r) - sum(l - 1) << endl;
}
