#include <bits/stdc++.h>
using namespace std;
set<long long> S;
void dfs(long long p) {
  S.insert(p);
  if (p >= 1000000000) return;
  dfs(p * 10 + 7);
  dfs(p * 10 + 4);
}
int main() {
  long long l, r, ans;
  dfs(0);
  scanf("%I64d%I64d", &l, &r);
  ans = 0;
  for (set<long long>::iterator it = S.begin(); it != S.end() && l <= r; it++)
    if (*it >= l) ans += (min(r, *it) - l + 1) * (*it), l = *it + 1;
  printf("%I64d\n", ans);
}
