#include <bits/stdc++.h>
using namespace std;
long long num[10000];
int k;
void dfs(long long x) {
  if (x > 4444444444) return;
  num[k++] = x;
  dfs(x * 10 + 4);
  dfs(x * 10 + 7);
}
int main() {
  int left, right, i;
  long long sum;
  sum = 0;
  k = 0;
  dfs(4);
  dfs(7);
  sort(num, num + k);
  scanf("%d%d", &left, &right);
  for (i = 0; i < k && left <= right; i++) {
    if (left <= num[i] && num[i] <= right) {
      sum += (num[i] - left + 1) * num[i];
      left = num[i] + 1;
    } else if (left <= num[i] && right <= num[i]) {
      sum += (right - left + 1) * num[i];
      left = right + 1;
    }
  }
  cout << sum << endl;
  return 0;
}
