#include <bits/stdc++.h>
using namespace std;
long long luck[10000];
int main() {
  int i, j, k, ct = 0;
  long long t, l, r;
  luck[0] = 4;
  for (i = 1; i < 12; i++) {
    for (j = 0; j < (1 << i); j++) {
      t = 0;
      for (k = i - 1; k >= 0; k--) t = 10 * t + ((j & (1 << k)) ? 7 : 4);
      luck[ct++] = t;
    }
  }
  cin >> l >> r;
  long long ans = 0;
  i = 0;
  while (luck[i] < l) {
    i++;
  }
  if (r >= luck[i])
    ans += (luck[i] - l + 1) * luck[i];
  else {
    ans += (r - l + 1) * luck[i];
    cout << ans << endl;
    return 0;
  }
  for (i++; luck[i] <= r; i++) {
    ans += (luck[i] - luck[i - 1]) * luck[i];
  }
  ans += (r - luck[i - 1]) * luck[i];
  cout << ans << endl;
  return 0;
}
