#include <bits/stdc++.h>
using namespace std;
const int T = 200001;
const long long MOD = 1000000000000007;
const long long MAX = 1000001;
const int MAXN = 200002;
long long n;
vector<long long> LN;
void rec(long long A) {
  long long na4 = A + 4;
  long long na7 = A + 7;
  LN.push_back(na4);
  LN.push_back(na7);
  if (na4 < MOD) {
    rec(na4 * 10);
    rec(na7 * 10);
  }
}
int main() {
  rec(0);
  long long l, r;
  cin >> l >> r;
  sort(LN.begin(), LN.end());
  auto itl = lower_bound(LN.begin(), LN.end(), l);
  auto itr = lower_bound(LN.begin(), LN.end(), r);
  long long ans = 0;
  while (itl != itr) {
    long long a = *itl;
    ans += a * (a - l + 1);
    l = a + 1;
    itl++;
  }
  long long a = *itl;
  ans += a * (r - l + 1);
  cout << ans << endl;
}
