#include <bits/stdc++.h>
using namespace std;
int n, m;
long long ans, sum, tmp;
long long q[5050];
int fr = 0, bk = 0;
int main() {
  long long a, b;
  cin >> a >> b;
  q[bk++] = 4, q[bk++] = 7;
  sum = 0;
  while (fr != bk && a <= b) {
    tmp = q[fr++];
    if (tmp >= a) {
      if (tmp <= b)
        sum += (tmp * (tmp - a + 1));
      else
        sum += (tmp * (b - a + 1));
      a = tmp + 1;
    }
    q[bk++] = tmp * 10 + 4;
    q[bk++] = tmp * 10 + 7;
  }
  cout << sum;
}
