#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> sorted;
  for (int len = 1; len < 13; len++) {
    int mxmask = (1 << len);
    for (int mask = 0; mask < mxmask; mask++) {
      long long cur = 0;
      for (int j = 0; j < len; j++) {
        cur *= 10;
        if ((mask & (1 << j)))
          cur += 4;
        else
          cur += 7;
      }
      sorted.push_back(cur);
    }
  }
  sort(sorted.begin(), sorted.end());
  long long L, R, st = -1, en = -1, last = -1;
  cin >> L >> R;
  long long ans = 0;
  for (int j = 0; j < sorted.size() && L <= R; j++) {
    if (L <= sorted[j]) {
      if (last == -1) ans += sorted[j];
      last = j;
      ans += 1ll * (sorted[j] - L) * sorted[j];
      L = sorted[j];
    }
  }
  ans -= 1ll * (L - R) * sorted[last];
  cout << ans << endl;
}
