#include <bits/stdc++.h>
using namespace std;
int l, r;
int a[100], len;
long long t[10010];
long long get(int *a, int n) {
  long long k = 1, t = 0;
  for (int i = n; i > 0; --i) {
    t = t + (k * a[i]);
    k *= 10;
  }
  return t;
}
void rec(int v, int n) {
  if (v > n) {
    t[++len] = get(a, n);
    return;
  }
  a[v] = 4;
  rec(v + 1, n);
  a[v] = 7;
  rec(v + 1, n);
}
int main() {
  cin >> l >> r;
  for (int i = 1; i <= 10; ++i) rec(1, i);
  int pos = 1;
  while (t[pos] < l) pos++;
  long long sum = 0;
  long long ll = l, rr = t[pos];
  while (rr <= r) {
    sum += (long long)(rr - ll + 1) * rr;
    ll = rr + 1;
    rr = t[++pos];
  }
  sum += (long long)(r - ll + 1) * t[pos];
  cout << sum << endl;
  return 0;
}
