#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
void fun(long long k, long long tt, long long ed) {
  if (tt == ed) {
    if (k <= 10000000000) v.push_back(k);
    return;
  }
  long long x = k * 10 + 4;
  fun(x, tt + 1, ed);
  x = k * 10 + 7;
  fun(x, tt + 1, ed);
}
int32_t main() {
  for (long long i = 1; i <= 10; i++) {
    fun(0, 0, i);
  }
  sort(v.begin(), v.end());
  long long l, r, ans = 0;
  cin >> l >> r;
  for (long long i = 0; i < v.size(); i++) {
    if (l > r) break;
    long long x = v[i];
    long long rr = min(r, x);
    if (rr >= l) {
      long long k = rr - l + 1;
      ans += (k * x);
      l = rr + 1;
    }
  }
  cout << ans << endl;
}
