#include <bits/stdc++.h>
using namespace std;
long long table[4000];
int tot = 0;
void maketable(int i, long long nb) {
  if (i == 10) return;
  long long nb1 = nb * 10 + 7, nb2 = nb * 10 + 4;
  table[tot++] = nb1;
  table[tot++] = nb2;
  maketable(i + 1, nb1);
  maketable(i + 1, nb2);
}
int main() {
  maketable(0, 0);
  sort(table, table + tot);
  long long l, r;
  long long summ = 0;
  cin >> l >> r;
  int pl, pr;
  for (pl = 0; pl < tot; ++pl)
    if (l <= table[pl]) break;
  for (pr = 0; pr < tot; ++pr)
    if (r <= table[pr]) break;
  if (pl == pr)
    summ = (r - l + 1) * table[pl];
  else {
    summ += table[pl] * (table[pl] - l + 1);
    summ += table[pr] * (r - table[pr - 1]);
    for (int i = pl + 1; i <= pr - 1; ++i)
      summ += table[i] * (table[i] - table[i - 1]);
  }
  cout << summ << endl;
  return 0;
}
