#include <bits/stdc++.h>
using namespace std;
int dirx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int diry[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
int l, r;
vector<long long> L;
void dfs(long long x) {
  if (x >= l) L.push_back(x);
  if (x > r) return;
  dfs(x * 10 + 4);
  dfs(x * 10 + 7);
}
int main() {
  cin >> l >> r;
  dfs(0);
  sort(L.begin(), L.end());
  long long curPos = l, ans = 0;
  while (curPos <= r) {
    long long lb = *lower_bound(L.begin(), L.end(), curPos);
    long long hi = min((long long)r, lb);
    ans += lb * (hi - curPos + 1);
    curPos = lb + 1;
  }
  cout << ans << endl;
  return 0;
}
