#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
std::pair<T, U> operator+(const std::pair<T, U>& l, const std::pair<T, U>& r) {
  return {l.first + r.first, l.second + r.second};
}
typedef void (*callback_function)(void);
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const long double PI = acos(-1.0L);
const long double EPS = static_cast<long double>(1e-9);
long long inv(long long a, long long b) {
  if (a != 1) {
    return b - (inv(b % a, a) * b) / a;
  }
  return 1;
}
inline int Pow(int a, int k) {
  int s = 1;
  for (; k; k >>= 1) {
    k& 1 ? s = 1LL * s * a % MOD : 0;
    a = 1LL * a * a % MOD;
  }
  return s;
}
const int N = 1e6 + 7;
void input() {}
long long MAX = 1e10;
vector<long long> v;
void init() {
  queue<long long> q;
  q.push(4);
  q.push(7);
  while (!q.empty()) {
    long long x = q.front();
    q.pop();
    v.push_back(x);
    x *= 10;
    if (x > MAX) {
      continue;
    }
    q.push(x + 4);
    q.push(x + 7);
  }
}
void solve() {
  init();
  int L, R;
  cin >> L >> R;
  int a = lower_bound(v.begin(), v.end(), L) - v.begin();
  int b = lower_bound(v.begin(), v.end(), R) - v.begin();
  if (a == b) {
    cout << v[a] * (R - L + 1) << endl;
    return;
  }
  long long sum = v[a] * (v[a] - L + 1) + v[b] * (R - v[b - 1]);
  for (int i = (a + 1); i < (b); i++) {
    sum += v[i] * (v[i] - v[i - 1]);
  }
  cout << sum << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  {
    input();
    solve();
  }
  return 0;
}
