#include <bits/stdc++.h>
using namespace std;
long long lucky;
long long digits(int num) {
  long long cnt = 0;
  while (num) {
    cnt++;
    num /= 10;
  }
  return cnt;
}
void initializeLucky(long long num) {
  lucky = 0;
  long long dgt = digits(num);
  for (int i = 0; i < dgt; i++) {
    lucky *= 10;
    lucky += 4;
  }
}
void nextLucky() {
  string str = "";
  long long num = lucky;
  while (num) {
    str += to_string(num % 10);
    num /= 10;
  }
  int i = 0;
  while (i < str.length()) {
    if (str[i] == '4') {
      str[i] = '7';
      break;
    } else {
      str[i] = '4';
    }
    i++;
  }
  if (i == str.length()) str += '4';
  lucky = 0;
  for (int i = str.length() - 1; i > -1; i--) {
    lucky *= 10;
    lucky += int(str[i] - '0');
  }
}
int main() {
  long long l, r;
  cin >> l >> r;
  initializeLucky(l);
  long long sum = 0;
  while (l <= r) {
    while (lucky < l) nextLucky();
    long long diff = min(r, lucky) - l + 1;
    sum += diff * lucky;
    l += diff;
  }
  cout << sum << endl;
  return 0;
}
