#include <bits/stdc++.h>
using namespace std;
const int maxn = 200;
vector<long long> luck;
void dfs(long long a, long long len) {
  if (len > 11) return;
  if (a) luck.push_back(a);
  dfs(a * 10 + 4, len + 1);
  dfs(a * 10 + 7, len + 1);
}
int main() {
  dfs(0, 0);
  sort(luck.begin(), luck.end());
  long long l, r;
  cin >> l >> r;
  long long ans = 0;
  while (l <= r) {
    long long f = *lower_bound(luck.begin(), luck.end(), l);
    if (f <= r) {
      ans += (f - l + 1) * f;
      l = f + 1;
    } else {
      ans += (r - l + 1) * f;
      break;
    }
  }
  cout << ans << endl;
}
