#include <bits/stdc++.h>
using namespace std;
long long l, r, ans;
vector<long long> lucky;
void lu(int f, int s) {
  string x = "";
  for (int i = 0; i < f; i++) x += '4';
  for (int i = 0; i < s; i++) x += '7';
  do lucky.push_back(atoll(x.c_str()));
  while (next_permutation(x.begin(), x.end()));
}
int main() {
  cin >> l >> r;
  for (int i = 0; i <= 10; i++)
    for (int j = 0; j <= 10; j++)
      if (i + j <= 10) lu(i, j);
  sort(lucky.begin(), lucky.end());
  int j, k;
  j = k = 0;
  while (lucky[j++] < l)
    ;
  j--;
  while (lucky[k++] < r)
    ;
  k--;
  ans += lucky[j] * (min(r - l, lucky[j] - l) + 1);
  if (lucky[j] == lucky[k]) return cout << ans << endl, 0;
  ans += lucky[k] * (r - lucky[k - 1]);
  for (int i = j + 1; i < k; i++) ans += (lucky[i] - lucky[i - 1]) * lucky[i];
  cout << ans << endl;
}
