#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1.0);
vector<long long> v1, v2;
long long ans = 0, x, y;
long long fact[1008], dp[1008][1008];
void pow1(long long a[], long long i, long long end, long long sum) {
  if (i == end) {
    v1.push_back(sum);
    return;
  }
  pow1(a, i + 1, end, sum + a[i]);
  pow1(a, i + 1, end, sum);
}
void subsetSums1(long long arr[], long long l, long long r, long long sum = 0) {
  if (l > r) {
    v1.push_back(sum);
    return;
  }
  subsetSums1(arr, l + 1, r, sum + arr[l]);
  subsetSums1(arr, l + 1, r, sum);
}
void subsetSums2(long long arr[], long long l, long long r, long long sum = 0) {
  if (l > r) {
    v2.push_back(sum);
    return;
  }
  subsetSums2(arr, l + 1, r, sum + arr[l]);
  subsetSums2(arr, l + 1, r, sum);
}
void pow2(long long a[], long long i, long long end, long long sum) {
  if (i == end) {
    v2.push_back(sum);
    return;
  }
  pow1(a, i + 1, end, sum + a[i]);
  pow1(a, i + 1, end, sum);
}
string bn(long long length) {
  string s;
  s.resize(length);
  char a[length];
  for (int i = 0; i < length; ++i) a[i] = '0';
  for (int i = 0; i < length; ++i) s[i] = a[i];
  cout << s;
  return s;
  int count = length - 1;
  while (length) {
    s[count--] = (length % 2);
    length /= 2;
  }
  return s;
}
long long powm(long long a, long long b, long long m) {
  if (b == 0) return 1;
  long long t = powm(a, b / 2, m);
  if (b % 2) return a * t % m * t % m;
  return t * t % m;
}
long long modinv1(long long b, long long m) { return powm(b, m - 2, m); }
long long nck(long long n, long long k) {
  return fact[n] * modinv1(fact[n - k], 1000000007) % 1000000007 *
         modinv1(fact[k], 1000000007) % 1000000007;
}
int suffix(int l, vector<int> v) {
  int ans = 0;
  long long p = 1;
  for (int i = 0; i < max((int)v.size(), l); ++i) {
    if (i < v.size()) {
      ans = (ans + p * v[i] % 998244353) % 998244353;
      p = (p * 10) % 998244353;
    }
    if (i < l) {
      p = (p * 10) % 998244353;
    }
  }
  return ans;
}
int prefix(vector<int> v, int l) {
  int ans = 0;
  long long p = 1;
  for (int i = 0; i < max((int)v.size(), l); ++i) {
    if (i < l) {
      p = (p * 10) % 998244353;
    }
    if (i < v.size()) {
      ans = (ans + p * v[i] % 998244353) % 998244353;
      p = (p * 10) % 998244353;
    }
  }
  return ans;
}
int ct = 0;
void sum(long long n) {
  if (n / 10 == 0) return;
  long long ans = 0;
  while (n) {
    ans += n % 10;
    n /= 10;
  }
  ct++;
  sum(ans);
}
vector<long long> v;
long long string_num(string);
void perm(long long l, long long cur, long long n) {
  if (cur == l) {
    v.push_back(n);
    return;
  }
  perm(l, cur + 1, n * 10 + 4);
  perm(l, cur + 1, n * 10 + 7);
}
long long string_num(string s) {
  int x = s.size();
  long long ans = 0, i = 0;
  while (x--) {
    ans += (pow(10, x) * (s[i++] - '0'));
  }
  return ans;
}
void DJ() {
  long long l, r;
  cin >> l >> r;
  long long ans = 0;
  for (int i = 1; i < 11; ++i) {
    perm(i, 0, 0);
  }
  long long it = lower_bound(v.begin(), v.end(), l) - v.begin();
  long long sum = r - l + 1;
  if (v[it] - l >= sum) {
    ans += sum * v[it];
    sum = 0;
  } else {
    ans += v[it] * (v[it] - l + 1);
    sum -= v[it] - l + 1;
    it++;
  }
  while (sum) {
    if (v[it] - v[it - 1] >= sum) {
      ans += sum * (v[it]);
      sum = 0;
    } else {
      ans += v[it] * (v[it] - v[it - 1]);
      sum -= v[it] - v[it - 1];
      it++;
    }
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) DJ();
  return 0;
}
