#include <bits/stdc++.h>
template <class T>
T abst(const T &n) {
  return (n < 0 ? -n : n);
}
template <class T>
T max3(const T &a, const T &b, const T &c) {
  return max2(a, max2(b, c));
}
template <class T>
T min3(const T &a, const T &b, const T &c) {
  return min2(a, min2(b, c));
}
template <class T>
T gcd(const T a, const T b) {
  return (b ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(const T a, const T b) {
  return (a / gcd<T>(a, b) * b);
}
template <class T>
T sq(const T &x) {
  return x * x;
}
using namespace std;
unsigned long long number[1024 + 3];
int main() {
  unsigned long long int l, r, i = 1, sum = 0;
  while (i <= 512) {
    number[2 * i] = number[i] * 10 + 4;
    number[2 * i + 1] = number[i] * 10 + 7;
    i += 1;
  }
  scanf("%lld %lld", &l, &r);
  i = 2;
  while (l <= r) {
    while (number[i] < l) i++;
    sum += (min(number[i], r) - l + 1) * number[i];
    l = number[i] + 1;
  }
  printf("%lld", sum);
}
