#include <bits/stdc++.h>
using namespace std;
int happy[500];
int l, r, m;
long long pred, tmp;
long long ans;
void next() {
  int j = 100;
  while (happy[j] == 7) j--;
  if (happy[j] == 4)
    happy[j] = 7;
  else
    happy[j] = 4;
  if (j < m) m = j;
  for (int i = j + 1; i < 101; i++) happy[i] = 4;
}
long long get_num() {
  long long result = 0;
  int j = m;
  while (j <= 100) {
    result *= 10;
    result += happy[j];
    j++;
  }
  return result;
}
int main() {
  scanf("%d %d", &l, &r);
  happy[100] = 4;
  m = 100;
  while (get_num() < l) next();
  pred = get_num();
  ans = (pred - l + 1) * pred;
  while (get_num() <= r) {
    tmp = get_num();
    ans += (tmp - pred) * tmp;
    pred = tmp;
    next();
  }
  ans += (r - pred) * get_num();
  cout << ans;
  return 0;
}
