#include <bits/stdc++.h>
using namespace std;
vector<long long> res;
void pre(int n) {
  for (int mask = 0; mask < (1 << n); mask++) {
    long long ret = 0;
    for (int i = 0; i < n; i++)
      if (mask & (1 << i))
        ret = ret * 10 + 7;
      else
        ret = ret * 10 + 4;
    res.push_back(ret);
  }
}
int solve(int l, int r, long long val) {
  if (l <= r) {
    int mid = l + (r - l) / 2;
    if (res[mid] >= val && (mid == l || res[mid - 1] < val) &&
        (mid == r || res[mid + 1] > val))
      return mid;
    if (res[mid] < val) return solve(mid + 1, r, val);
    return solve(l, mid - 1, val);
  }
}
int main() {
  for (int i = 1; i <= 9; i++) pre(i);
  long long val = 0;
  for (int i = 0; i < 10; i++) val = val * 10 + 4;
  res.push_back(val);
  sort(res.begin(), res.end());
  long long l, r;
  cin >> l >> r;
  int left_pos = solve(0, res.size() - 1, l);
  int right_pos = solve(0, res.size() - 1, r);
  long long ret = (min(r, res[left_pos]) - l + 1) * res[left_pos];
  for (int i = left_pos + 1; i <= right_pos; i++) {
    ret += (min(r, res[i]) - res[i - 1]) * res[i];
  }
  cout << ret << "\n";
}
