#include <bits/stdc++.h>
using namespace std;
vector<long long> vec;
set<int> sset;
int flag[15];
void push(int t) {
  long long s = 0;
  for (int i = 0; i <= t; i++) {
    s = s * 10 + flag[i];
  }
  if (sset.find(s) == sset.end()) {
    vec.push_back(s);
    sset.insert(s);
  }
}
void dfs(int t) {
  if (t == 11) {
    return;
  }
  flag[t] = 4;
  push(t);
  dfs(t + 1);
  flag[t] = 7;
  push(t);
  dfs(t + 1);
}
int main() {
  dfs(0);
  sort(vec.begin(), vec.end());
  int l, r;
  while (cin >> l >> r) {
    int first;
    int last;
    for (int i = 0; i < vec.size(); i++) {
      if (vec[i] >= l) {
        first = i;
        break;
      }
    }
    for (int i = 0; i < vec.size(); i++) {
      if (vec[i] > r) {
        last = i;
        break;
      }
    }
    if (first == last) {
      cout << vec[first] * (r - l + 1) << endl;
      continue;
    }
    long long ans = 0;
    ans += (vec[first] - l + 1) * vec[first];
    for (int i = first + 1; i < last; i++) {
      ans += vec[i] * (vec[i] - vec[i - 1]);
    }
    ans += vec[last] * (r - vec[last - 1]);
    cout << ans << endl;
  }
  return 0;
}
