#include <bits/stdc++.h>
using namespace std;
set<long long> holder11;
void fill() {
  set<long long> a = holder11;
  for (auto it : a) {
    holder11.insert(it * 10 + 4);
    holder11.insert(it * 10 + 7);
  }
}
void solve() {
  holder11.insert(4);
  holder11.insert(7);
  for (int i = 1; i < 10; i++) {
    fill();
  }
  long long a, b, lb, ub, c = -1, sum1 = 0, sum2 = 0;
  cin >> a >> b;
  vector<long long> holder1;
  for (auto it : holder11) {
    if (it > b) {
      c = it;
      break;
    }
    if (it >= a) holder1.push_back(it);
  }
  if (holder1.size() == 0) {
    cout << (b - a + 1) * c;
    return;
  }
  sum1 = (holder1[0] - a + 1) * holder1[0];
  if (c != -1) sum2 = (b - holder1[holder1.size() - 1]) * c;
  if (holder1.size() == 1)
    cout << sum1 + sum2;
  else {
    for (int i = 1; i < holder1.size(); i++) {
      sum1 += (holder1[i] - holder1[i - 1]) * holder1[i];
    }
    cout << sum1 + sum2;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long q = 1;
  while (q--) {
    solve();
  }
  return 0;
}
