#include <bits/stdc++.h>
using namespace std;
vector<long long int> lucky;
void gen(long long int num, int cnt) {
  if (cnt == 0) {
    lucky.push_back(num);
    return;
  }
  gen(num * 10 + 4, cnt - 1);
  gen(num * 10 + 7, cnt - 1);
}
int main() {
  for (int i = 1; i <= 11; i++) gen(0, i);
  int sz = lucky.size();
  long long int l, r;
  cin >> l >> r;
  long long int L = l, R = r;
  long long int ans = 0;
  while (L <= R) {
    int pos = lower_bound(lucky.begin(), lucky.end(), L) - lucky.begin();
    long long int rr = lucky[pos];
    if (rr > R) rr = R;
    long long int df = 1 + rr - L;
    ans = ans + df * lucky[pos];
    L = lucky[pos] + 1;
    if (lucky[pos] > R) break;
  }
  cout << ans;
  return 0;
}
