#include <bits/stdc++.h>
using namespace std;
vector<long long> luckies;
long long L = 0, R = 0;
const long long INF = 1e10;
void GEN(long long cur) {
  if (cur > INF) return;
  if (cur >= L) luckies.push_back(cur);
  GEN(cur * 10 + 4);
  GEN(cur * 10 + 7);
}
void precalc() {
  luckies.push_back(L - 1);
  GEN(0);
  sort(luckies.begin(), luckies.end());
}
int main() {
  long long RESULT = 0;
  scanf("%lld%lld", &L, &R);
  precalc();
  for (int i = 1; i < luckies.size(); i++) {
    if (luckies[i] > R) {
      RESULT = RESULT + (R - luckies[i - 1]) * luckies[i];
      break;
    } else
      RESULT = RESULT + (luckies[i] - luckies[i - 1]) * luckies[i];
    if (luckies[i] == R) break;
  }
  cout << RESULT;
  return 0;
}
