#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7FFFFFFF;
const double eps = 1e-10;
const double pi = acos(-1.0);
long long L, R;
vector<long long> ans;
void dfs(long long ret) {
  if (ret > 5000000000LL) return;
  if (ret != 0) ans.push_back(ret);
  dfs(ret * 10 + 4);
  dfs(ret * 10 + 7);
}
void init() {
  ans.clear();
  dfs(0);
  sort(ans.begin(), ans.end());
}
void solve() {
  long long ret = 0;
  cin >> L >> R;
  int pos;
  for (int i = 0; i < ans.size(); i++)
    if (ans[i] >= L) {
      ret = ret + ans[i] * (min(R - L + 1, ans[i] - L + 1));
      L = ans[i] + 1;
      pos = i;
      break;
    }
  for (int i = pos + 1; i < ans.size(); i++) {
    if (L > R) break;
    ret = ret + ans[i] * (min(R - L + 1, ans[i] - L + 1));
    L = ans[i] + 1;
    if (ans[i] >= R) break;
  }
  cout << ret << endl;
}
int main() {
  init();
  solve();
  return 0;
}
