#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const long long INF = 2e18;
void print(int a[], int n) {
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << "\n";
}
vector<long long> luckyNum;
void generateLuckyNum(long long x) {
  luckyNum.push_back(x * 10 + 4);
  luckyNum.push_back(x * 10 + 7);
  if (x * 10 > 1e18) return;
  generateLuckyNum(x * 10 + 4);
  generateLuckyNum(x * 10 + 7);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc = 1;
  while (tc--) {
    long long l, r;
    cin >> l >> r;
    generateLuckyNum(0);
    sort(luckyNum.begin(), luckyNum.end());
    long long L =
        lower_bound(luckyNum.begin(), luckyNum.end(), l) - luckyNum.begin();
    long long R =
        lower_bound(luckyNum.begin(), luckyNum.end(), r) - luckyNum.begin();
    long long ans = 0;
    ans += luckyNum[L] * (luckyNum[L] - l + 1);
    ans += luckyNum[R] * (r - (luckyNum[R] + 1) + 1);
    for (long long i = L + 1; i <= R; i++) {
      ans += luckyNum[i] * (luckyNum[i] - luckyNum[i - 1]);
    }
    cout << ans;
  }
}
