#include <bits/stdc++.h>
using namespace std;
long long l, r, luck[100000], p = 3, ansl, ansr;
int main() {
  cin >> l >> r;
  luck[1] = 4;
  luck[2] = 7;
  for (long long i = 1; i <= 512; i++) {
    luck[p++] = luck[i] * 10 + 4;
    luck[p++] = luck[i] * 10 + 7;
  }
  p = 1;
  while (1) {
    if (luck[p] <= l - 1)
      ansl += (long long)((luck[p] - luck[p - 1]) * luck[p]);
    else {
      ansl += (long long)((l - 1 - luck[p - 1]) * luck[p]);
      break;
    }
    p++;
  }
  p = 1;
  while (1) {
    if (luck[p] <= r)
      ansr += (long long)((luck[p] - luck[p - 1]) * luck[p]);
    else {
      ansr += (long long)((r - luck[p - 1]) * luck[p]);
      break;
    }
    p++;
  }
  cout << ansr - ansl;
  return 0;
}
