#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long int sum = 0, l, r, tmp = 0;
  bool found = false;
  vector<long long int> luckies;
  cin >> l >> r;
  luckies.push_back(4), luckies.push_back(7);
  for (unsigned int i = 0;; i++) {
    if (l <= luckies[i]) {
      if (luckies[i] >= r) {
        if (l == r) {
          sum = luckies[i];
        } else if (r < luckies[i]) {
          if (!found)
            sum += (r - l + 1) * luckies[i];
          else
            sum += (r - l) * luckies[i];
        } else if (r == luckies[i]) {
          if (!found)
            sum += (r - l + 1) * luckies[i];
          else
            sum += (r - l) * luckies[i];
        }
        break;
      }
      if (!found)
        sum += (luckies[i] - l + 1) * luckies[i], found = true;
      else
        sum += (luckies[i] - l) * luckies[i];
      l = luckies[i];
    }
    if (luckies[i] < 4444444444LL)
      luckies.push_back(luckies[i] * 10 + 4),
          luckies.push_back(luckies[i] * 10 + 7);
  }
  cout << sum;
  return 0;
}
