#include <bits/stdc++.h>
using namespace std;
int num = 0;
long long temp[10001], L, R;
void DFS(long long now) {
  if (now > R) {
    temp[num++] = now;
    return;
  }
  temp[num++] = now;
  DFS(now * 10 + 4);
  DFS(now * 10 + 7);
}
long long work(long long c) {
  long long sum = 0;
  int i = 1;
  for (; i < num && temp[i] <= c; i++) sum += (temp[i] - temp[i - 1]) * temp[i];
  if (i != num) sum += (c - temp[i - 1]) * temp[i];
  return sum;
}
int main() {
  scanf("%I64d%I64d", &L, &R);
  DFS(0);
  sort(temp, temp + num);
  printf("%I64d", work(R) - work(L - 1));
  return 0;
}
