#include <bits/stdc++.h>
using namespace std;
vector<long long> p;
int val[3] = {0, 4, 7};
void rec(int idx, long long x, bool z) {
  if (idx == 12) {
    if (x > 0) p.emplace_back(x);
    return;
  }
  int mn = z ? 1 : 0;
  for (int i = mn; i < 3; i++) {
    rec(idx + 1, x * 10 + val[i], z || val[i] != 0);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  rec(0, 0, 0);
  int l, r;
  cin >> l >> r;
  int n = (int)p.size(), i = 0;
  while (i < n && p[i] < l) i++;
  long long ans = 0;
  while (i < n && p[i] < r) {
    ans += 1ll * (p[i] - l + 1) * p[i];
    l = p[i] + 1, i++;
  }
  ans += (r - l + 1) * p[i];
  cout << ans << '\n';
  return 0;
}
