#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
void solve() {
  vector<vector<long long int>> v(11);
  vector<long long int> f;
  v[0].push_back(4);
  v[0].push_back(7);
  f.push_back(4);
  f.push_back(7);
  for (long long int i = 1; i < 11; i++) {
    vector<long long int> tmp;
    for (long long int j = 0; j < v[i - 1].size(); j++) {
      f.push_back(v[i - 1][j] * 10 + 4);
      f.push_back(v[i - 1][j] * 10 + 7);
      tmp.push_back(v[i - 1][j] * 10 + 4);
      tmp.push_back(v[i - 1][j] * 10 + 7);
    }
    v[i] = tmp;
  }
  long long int l, r;
  cin >> l >> r;
  vector<long long int>::iterator it;
  long long int sum = 0;
  for (long long int i = l; i < r + 1; i++) {
    it = lower_bound(f.begin(), f.end(), i);
    long long int in = it - f.begin();
    if (f[in] <= r) {
      sum += ((f[in] - i + 1) * f[in]);
      i = f[in];
    } else {
      sum += (r - i + 1) * f[in];
      break;
    }
  }
  cout << sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  solve();
  return 0;
}
