#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
vector<long long> v;
void lucky(long long x) {
  queue<long long> q;
  q.push(x);
  while (x < 1e9) {
    x = q.front();
    q.pop();
    x *= 10;
    q.push(x + 4);
    q.push(x + 7);
    v.push_back(x + 4);
    v.push_back(x + 7);
  }
}
int next(long long x) {
  int str = 0, ed = v.size() - 1, ans;
  while (str <= ed) {
    int mid = str + ((ed - str) / 2);
    if (v[mid] >= x) {
      ans = mid;
      ed = mid - 1;
    } else
      str = mid + 1;
  }
  return ans;
}
int main() {
  long long x, y;
  cin >> x >> y;
  lucky(0);
  unsigned long long sum = 0;
  sort(v.begin(), v.end());
  int z = next(x);
  if (y <= v[z])
    return cout << (y - x + 1) * v[z], 0;
  else {
    sum += (v[z] - x + 1) * v[z];
    int i;
    for (i = z + 1; v[i] <= y; i++) {
      sum += (v[i] - v[i - 1]) * v[i];
    }
    sum += (y - v[i - 1]) * v[i];
  }
  cout << sum;
}
