#include <bits/stdc++.h>
using namespace std;
vector<long long int> tabela;
int main() {
  tabela.clear();
  tabela.push_back(4);
  tabela.push_back(7);
  long long int k = 2;
  long long int j = 2;
  long long int p = 10;
  while (k <= 512) {
    for (int i = j - k; i <= j - 1; i++) tabela.push_back(4 * p + tabela[i]);
    for (int i = j - k; i <= j - 1; i++) tabela.push_back(7 * p + tabela[i]);
    p *= 10;
    k *= 2;
    j += k;
  }
  long long int ans = 0;
  long long int l, r;
  cin >> l;
  cin >> r;
  int i;
  for (i = 0; tabela[i] < l; i++)
    ;
  while (l <= r) {
    ans += (min(tabela[i], r) - l + 1) * tabela[i];
    l = min(tabela[i], r) + 1;
    i++;
  }
  cout << ans;
  printf("\n");
  return 0;
}
