#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
long long arr[1025];
int cnt = 0;
void init() {
  long long s = 0;
  queue<long long> Q;
  Q.push(s);
  while (!Q.empty()) {
    long long top = Q.front();
    Q.pop();
    arr[cnt++] = top;
    if (top >= inf) break;
    Q.push(top * 10 + 4);
    Q.push(top * 10 + 7);
  }
}
int main() {
  int l, r;
  long long ans = 0;
  scanf("%d%d", &l, &r);
  init();
  int pre = l;
  for (int i = 1; i < cnt; i++) {
    if (arr[i] < pre) continue;
    if (arr[i] >= r) {
      ans += (r - pre + 1) * arr[i];
      break;
    } else {
      ans += (arr[i] - pre + 1) * arr[i];
      pre = arr[i] + 1;
    }
  }
  cout << ans << endl;
  return 0;
}
