#include <bits/stdc++.h>
using namespace std;
long long a[200000], l, r, i, j, n, m, tot, ans;
bool cmp(long long a, long long b) { return (a < b); }
void DFS(int pos, long long sum) {
  if (pos > 1) {
    tot++;
    a[tot] = sum;
  }
  if (pos == 11) return;
  DFS(pos + 1, sum * 10 + 4);
  DFS(pos + 1, sum * 10 + 7);
  return;
}
int main() {
  cin >> l >> r;
  tot = 0;
  DFS(1, 0);
  sort(a + 1, a + tot + 1, cmp);
  i = 1;
  ans = 0;
  while (l <= r) {
    while (a[i] < l) i++;
    if (a[i] <= r) {
      ans += (a[i] - l + 1) * a[i];
      l = a[i] + 1;
    } else {
      ans += (r - l + 1) * a[i];
      l = r + 1;
    }
  }
  cout << ans << endl;
  return 0;
}
