#include <bits/stdc++.h>
using namespace std;
long long all[5000];
long long cnt = 0;
void dfs(long long num, long long step) {
  all[cnt] = num;
  cnt++;
  if (step == 10) {
    return;
  }
  dfs(num * 10 + 7ll, step + 1);
  dfs(num * 10 + 4ll, step + 1);
}
long long kkk(long long x) {
  long long ans = 0;
  for (int i = 0; i < cnt - 1; i++) {
    if (x <= 0) return ans;
    ans += all[i + 1] * (min(x, all[i + 1] - all[i]));
    x -= min(x, all[i + 1] - all[i]);
    if (x <= 0) return ans;
  }
  return ans;
}
int main() {
  long long t, i, j, k, l, a, b, n, m, p;
  long long fff = 0;
  dfs(0, 0);
  sort(all, all + cnt);
  scanf("%lld", &m);
  scanf("%lld", &n);
  printf("%lld", kkk(n) - kkk(m - 1));
  return 0;
}
