#include <bits/stdc++.h>
using namespace std;
static bool comp(pair<int, int>& p1, pair<int, int>& p2) {
  return p1.first < p2.first;
}
int solve(vector<int>& a, int n) {
  if (n <= 1) {
    return 0;
  }
  int ans = 0;
  int maxi = max(a[0], a[1]);
  int mini = min(a[0], a[1]);
  if (maxi != mini) {
    ans++;
  }
  for (int i = 2; i < n; i++) {
    if (a[i] > maxi) {
      maxi = a[i];
      ans++;
    }
    if (a[i] < mini) {
      mini = a[i];
      ans++;
    }
  }
  return ans;
}
bool isValid(string& str1, string& str2) {
  int n1, n2;
  n1 = str1.length();
  n2 = str2.length();
  if (n1 != n2) {
    return false;
  }
  int i = 0, j = n2 - 1;
  while (i < n1 && j >= 0) {
    if (str1[i] != str2[j]) {
      return false;
    }
    i++;
    j--;
  }
  return true;
}
struct comppq {
  bool operator()(pair<char, int>& p1, pair<char, int>& p2) {
    return p1.second < p2.second;
  }
};
string makeKString(string& str, int k) {
  int i, j, x;
  vector<int> count(26, 0);
  for (auto it : str) {
    count[it - 'a']++;
  }
  int cnt = 0;
  for (i = 0; i < 26; i++) {
    if (count[i] > 0) {
      if (count[i] % k != 0) {
        return "-1";
      }
    }
  }
  string temp = "";
  for (i = 0; i < 26; i++) {
    if (count[i] > 0) {
      cnt = count[i] / k;
      while (cnt--) {
        temp += (i + 'a');
      }
    }
  }
  string ans = "";
  while (k--) {
    ans += temp;
  }
  return ans;
}
int main() {
  long long n, i, l, r;
  vector<long long> a;
  queue<long long> q1;
  q1.push(4);
  q1.push(7);
  while (!q1.empty() && q1.front() <= 1e10) {
    a.push_back(q1.front());
    long long x = q1.front();
    q1.pop();
    q1.push(x * 10 + 4);
    q1.push(x * 10 + 7);
  }
  auto it = lower_bound(a.begin(), a.end(), 1e9);
  cin >> l >> r;
  long long sum = 0;
  i = l;
  while (i <= r) {
    auto it = lower_bound(a.begin(), a.end(), i);
    sum += (min(r, a[it - a.begin()]) - i + 1) * a[it - a.begin()];
    i = a[it - a.begin()] + 1;
  }
  cout << sum;
  return 0;
}
