#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > v(103);
long long ans = 0;
int r, l, last;
queue<long long int> q;
void solve() {
  vector<long long int> v;
  int num = 0;
  int cnt = 0;
  v.push_back(num);
  long long int temp, temp1;
  while (1) {
    temp = v[cnt++];
    if (last >= r) break;
    temp1 = temp * 10 + 4;
    v.push_back(temp1);
    if (temp1 > last && temp1 <= r) {
      ans += (temp1 - last) * temp1;
      last = temp1;
    } else if (temp1 > r && last < r) {
      ans += (r - last) * temp1;
      break;
    }
    temp1 = temp * 10 + 7;
    v.push_back(temp1);
    if (temp1 > last && temp1 <= r) {
      ans += (temp1 - last) * temp1;
      last = temp1;
    } else if (temp1 > r && last < r) {
      ans += (r - last) * temp1;
      break;
    }
    if (cnt == v.size()) break;
  }
}
int main() {
  cin >> l >> r;
  last = l - 1;
  q.push(0);
  solve();
  cout << ans << endl;
}
