#include <bits/stdc++.h>
using namespace std;
long long int a, b, k;
long long int LN[2500];
void read() {
  scanf("%lld", &a);
  scanf("%lld", &b);
}
void find(long long int a, long long int b) {
  if (b > 10) return;
  LN[k++] = a;
  find(a * 10 + 4, b + 1);
  find(a * 10 + 7, b + 1);
  return;
}
void solve() {
  long long int i, f, res = 0;
  int amount = b - a + 1;
  for (i = 1; i < k and amount; i++)
    if (LN[i] - a >= 0) {
      f = (LN[i] - a + 1);
      if (f > amount) f = amount;
      res += f * LN[i];
      amount -= f;
      a += f;
    }
  cout << res << endl;
}
int main() {
  read();
  find(0ll, 0ll);
  sort(LN, LN + k);
  solve();
}
