#include <bits/stdc++.h>
using namespace std;
long long mod = (long long)1000000000;
vector<long long int> add(vector<long long int> arr, long long num) {
  long long count = num;
  int csize = 1;
  while (count != 0) {
    if (csize > arr.size()) {
      long long temp = count;
      arr.push_back(temp % mod);
      count = temp / mod;
    } else {
      long long temp = arr[csize - 1] + count;
      count = temp / mod;
      arr[csize - 1] = temp % mod;
    }
    csize++;
  }
  return arr;
}
int main() {
  long long int final = (long long int)4444444447;
  long long int a[2000];
  int size = 2;
  a[0] = 4;
  a[1] = 7;
  int curr = 0;
  long long int curr10 = 10;
  while (a[size - 1] < final) {
    a[size] = a[curr] * curr10 + 4;
    a[size + 1] = a[curr] * curr10 + 7;
    curr++;
    size += 2;
  }
  long long int l, r;
  cin >> l >> r;
  long long sum = 0;
  long long currsum = 0;
  long long currl = l;
  int initidx = 0;
  while (a[initidx] < l) initidx++;
  while (r - currl >= 0) {
    long long h = min(r, a[initidx]);
    currsum = (h - currl + 1) * a[initidx];
    sum += currsum;
    initidx++;
    currl = a[initidx - 1] + 1;
  }
  cout << sum << endl;
}
