#include <bits/stdc++.h>
using namespace std;
long long ans;
string l, r;
long long get(string &s) {
  long long res = 0;
  for (char c : s) res = 10 * res + (long long)(c - '0');
  return res;
}
string get_s(long long x) {
  string res;
  while (x) {
    res += (char)((x % 10) + '0');
    x /= 10;
  }
  reverse(res.begin(), res.end());
  return res;
}
string nxt(string s) {
  long long indx = 0;
  while (indx < s.size() && (s[indx] == '4' || s[indx] == '7')) indx++;
  if (indx == (long long)s.size()) return s;
  if (s[indx] < '4') {
    for (long long i = indx; i < s.size(); i++) s[i] = '4';
    return s;
  }
  if (s[indx] < '7') {
    s[indx] = '7';
    for (long long i = indx + 1; i < s.size(); i++) s[i] = '4';
    return s;
  }
  for (long long i = indx - 1; ~i; i--) {
    if (s[i] == '4') {
      s[i] = '7';
      for (long long j = i + 1; j < s.size(); j++) s[j] = '4';
      return s;
    }
  }
  string res;
  for (long long i = 0; i <= (long long)s.size(); i++) res += '4';
  return res;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> l >> r;
  while (get(l) <= get(r)) {
    string tmp = nxt(l);
    ans += (min(get(r), get(tmp)) - get(l) + 1) * get(tmp);
    l = get_s(min(get(r), get(tmp)) + 1);
  }
  cout << ans;
}
