#include <bits/stdc++.h>
const int maxn = 1000000 + 5;
const int INF = 1000000000;
using namespace std;
long long a[maxn];
int main() {
  long long l, r;
  int cnt = 2;
  long long len = 10;
  a[0] = 4;
  a[1] = 7;
  int last = 0, now = 1;
  while (len <= INF) {
    int temlast = cnt;
    for (int i = last; i <= now; i++) {
      a[cnt++] = 4 * len + a[i];
    }
    for (int i = last; i <= now; i++) {
      a[cnt++] = 7 * len + a[i];
    }
    last = temlast;
    now = cnt - 1;
    len = len * 10;
  }
  while (cin >> l >> r) {
    long long ans = 0;
    int p = 0;
    for (int i = l; i <= r;) {
      if (i == a[p]) {
        ans += i;
        i++;
      } else if (a[p] < i)
        p++;
      else {
        if (r < a[p]) {
          ans += a[p] * (r - i + 1);
          break;
        } else {
          ans += a[p] * (a[p] - i + 1);
          i = a[p] + 1;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
