#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int l, r;
vector<long long> lucky;
int main() {
  for (int i = 1; i <= 10; i++) {
    long long mask = 0;
    long long num;
    while (mask < (1 << i)) {
      num = 0;
      for (int j = 0; j < i; j++) {
        if (mask & (1 << j))
          num = (num * 10) + 4;
        else
          num = (num * 10) + 7;
      }
      lucky.push_back(num);
      mask++;
    }
  }
  sort(lucky.begin(), lucky.end());
  cin >> l >> r;
  long long ans = 0;
  while (l <= r) {
    int pos = upper_bound(lucky.begin(), lucky.end(), l - 1) - lucky.begin();
    long long num = lucky[pos];
    ans += (min(num, r * 1LL) - l + 1) * 1LL * num;
    l = min(num, r * 1LL) + 1;
  }
  cout << ans << '\n';
  return 0;
}
