#include <bits/stdc++.h>
using namespace std;
long long n, m, k, y, a, b, c;
long long A[1005], B[1005], C[1005];
string s;
vector<long long> lucky;
long long limit = 7777777777;
void dfs(long long u) {
  if (u > limit) return;
  lucky.push_back(u);
  dfs(u * 10 + 4);
  dfs(u * 10 + 7);
}
int main() {
  dfs(4LL);
  dfs(7LL);
  sort(lucky.begin(), lucky.end());
  for (long long x : lucky) {
  }
  cin >> a >> b;
  long long ans = 0;
  for (int i = 0; i < lucky.size() && a <= b; i++) {
    if (lucky[i] < a) {
      continue;
    }
    if (lucky[i] >= b) {
      ans += lucky[i] * (b - a + 1);
    } else {
      ans += lucky[i] * (lucky[i] - a + 1);
    }
    a = lucky[i] + 1;
    if (lucky[i] >= b) break;
  }
  cout << ans << '\n';
}
