#include <bits/stdc++.h>
long long int power(long long int x, long long int b, long long int mod1) {
  long long int p = 1;
  while (b > 0) {
    if (b & 1) {
      p = p * x;
      p %= mod1;
    }
    b >>= 1;
    x *= x;
    x %= mod1;
  }
  return p % mod1;
}
using namespace std;
struct lex_compare {
  bool operator()(const pair<long long int, long long int> p1,
                  const pair<long long int, long long int> p2) {
    return p1.first > p2.first;
  }
};
void rec(long long int curr, set<long long int> &s) {
  if (curr > 1e10) {
    return;
  }
  if (curr != 0) {
    s.insert(curr);
  }
  rec(curr * 10 + 4, s);
  rec(curr * 10 + 7, s);
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  set<long long int> s;
  long long int curr = 0;
  rec(curr, s);
  long long int l, r;
  cin >> l >> r;
  auto i = s.lower_bound(l);
  auto j = ++i;
  i--;
  long long int ans = (min(*i, r) - l + 1) * (*i);
  l = *i + 1;
  while (l <= r) {
    j = ++i;
    i--;
    ans += (min(*j, r) - l + 1) * (*j);
    l = *j + 1;
    i++;
    j++;
  }
  cout << ans << "\n";
  return 0;
}
