#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
void solve(string str) {
  if (str.size() > 9) return;
  v.push_back(stoll(str + "4"));
  solve(str + "4");
  v.push_back(stoll(str + "7"));
  solve(str + "7");
}
int32_t main() {
  long long ans = 0, l, r, temp;
  cin >> l >> r;
  solve("");
  sort(v.begin(), v.end());
  temp = l;
  for (long long i = 0; i < v.size(); i++) {
    if (v[i] >= l && v[i] <= r) {
      ans += (v[i] - temp + 1) * (v[i]);
      temp = v[i] + 1;
    } else if (r < v[i]) {
      ans += (r - temp + 1) * (v[i]);
      break;
    }
  }
  cout << ans;
}
