#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long a) {
  if (a == 0) return 1;
  long long half = power(x, a / 2);
  half = ((half % 1000000007) * (half % 1000000007)) % 1000000007;
  if (a & 1) half = (half * x) % 1000000007;
  return half;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  vector<long long> v;
  v.push_back(4);
  v.push_back(7);
  for (long long i = 2; i <= 10; i++) {
    long long k = power(2, i) - 3;
    for (long long j = 0; j < power(2, i - 1); j++) {
      v.push_back(4 * power(10, i - 1) + v[k]);
      v.push_back(7 * power(10, i - 1) + v[k]);
      k--;
    }
  }
  sort(v.begin(), v.end());
  long long l, r, pos1 = -1, pos2 = -1, val1, val2;
  cin >> l >> r;
  if (l <= v[0]) {
    pos1 = 0;
    val1 = v[0];
  }
  if (r <= v[0]) {
    pos2 = 0;
    val2 = v[0];
  } else {
    for (long long i = 0; i < v.size() - 1; i++) {
      if (l > v[i] && l <= v[i + 1]) {
        val1 = v[i + 1];
        pos1 = i + 1;
      }
      if (r > v[i] && r <= v[i + 1]) {
        val2 = v[i + 1];
        pos2 = i + 1;
      }
      if (pos1 != -1 && pos2 != -1) break;
    }
  }
  if (pos1 == pos2)
    cout << (r - l + 1) * val1;
  else {
    long long ans = 0;
    for (long long i = pos1; i < pos2; i++) {
      ans += (v[i] - l + 1) * v[i];
      l = v[i] + 1;
    }
    ans += (r - l + 1) * val2;
    cout << ans;
  }
  return 0;
}
