#include <bits/stdc++.h>
using namespace std;
void Draganov47() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
vector<long long> my;
void f(long long x, int sz) {
  if (sz == 11) return;
  my.push_back(x);
  f(x + pow(10, sz) * 4, sz + 1);
  f(x + pow(10, sz) * 7, sz + 1);
}
int main() {
  Draganov47();
  long long l, r;
  cin >> l >> r;
  f(4, 1);
  f(7, 1);
  sort((my).begin(), (my).end());
  unsigned long long ans = 0, e = l;
  int L = lower_bound((my).begin(), (my).end(), l) - my.begin(),
      R = lower_bound((my).begin(), (my).end(), r) - my.begin();
  for (int i = L; i <= R; i++) {
    ans += (min(r, my[i]) - e + 1) * my[i];
    e = my[i] + 1;
  }
  cout << ans;
  return 0;
}
