#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265359;
const double EPS = 1e-6;
const long long INF = ((long long)1 << 61);
const long long P = 1e9 + 7;
const long long LIM = 21000000;
vector<long long> nums;
void gen(int len) {
  for (long long i = 0; i <= (1LL << len) - 1LL; i++) {
    long long num = 0;
    for (long long j = len; j >= 1; j--) {
      num *= 10;
      if ((i >> (j - 1)) & 1)
        num += 7;
      else
        num += 4;
    }
    nums.push_back(num);
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  for (int i = 1; i <= 10; i++) gen(i);
  long long l, r;
  cin >> l >> r;
  long long res = 0;
  for (int i = 0; i <= nums.size(); i++) {
    if (nums[i] >= l) {
      res += nums[i] * (min(r, nums[i]) - l + 1);
      l = nums[i] + 1;
    }
    if (nums[i] >= r) break;
  }
  cout << res << endl;
  return 0;
}
