#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const unsigned long long INFLL = 100000000000000000ll;
const unsigned long long MOD = 1000000007;
unsigned long long L, R;
set<unsigned long long> V;
void gen(unsigned long long n, int d) {
  if (d == 11) return;
  V.insert(n);
  gen(n * 10 + 4, d + 1), gen(n * 10 + 7, d + 1);
}
int main() {
  gen(4, 1), gen(7, 1);
  cin >> L >> R;
  unsigned long long ans = 0;
  while (L <= R) {
    unsigned long long num = *V.lower_bound(L);
    unsigned long long next = min(num, R);
    ans += (next - L + 1) * num;
    L = next + 1;
  }
  cout << ans;
}
