#include <bits/stdc++.h>
using namespace std;
int dcmp(double x, double y) {
  return fabs(x - y) <= 1e-9 ? 0 : x < y ? -1 : 1;
};
vector<long long> holder;
void dfs(long long num, int i) {
  if (i == 10) {
    if (num) holder.push_back(num);
    return;
  }
  dfs(num * 10 + 4, i + 1);
  dfs(num * 10 + 7, i + 1);
  dfs(num, i + 1);
}
long long solve(long long idx) {
  long long ret = 0;
  long long hold = 0;
  for (int i = 0; i < ((int)((holder).size())); ++i) {
    if (idx >= holder[i]) {
      ret += (holder[i] * (holder[i] - hold));
      hold = holder[i];
    } else {
      ret += (idx - hold) * holder[i];
      break;
    }
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long l, r;
  cin >> l >> r;
  dfs(0, 1);
  sort(holder.begin(), holder.end());
  holder.push_back(4444444444);
  cout << solve(r) - solve(l - 1) << '\n';
}
