#include <bits/stdc++.h>
using namespace std;
vector<long long> lucky;
void generateLucky() {
  for (int i = 0; i < 11; i++) {
    for (int j = 0; j < 1 << i; j++) {
      long long num = 0;
      long long ten = 1;
      for (int d = 0; d < i; d++) {
        if (j & (1 << d))
          num += 7 * ten;
        else
          num += 4 * ten;
        ten *= 10;
      }
      lucky.push_back(num);
    }
  }
}
int main() {
  generateLucky();
  long long l, r;
  cin >> l >> r;
  int start = int(lower_bound(lucky.begin(), lucky.end(), l) - lucky.begin());
  unsigned long long ans = 0;
  while (lucky[start] < r) {
    ans += (lucky[start] - l + 1) * lucky[start];
    l = lucky[start] + 1;
    start++;
  }
  ans += lucky[start] * (r - max(l - 1, lucky[start - 1]));
  cout << ans << endl;
  return 0;
}
