#include <bits/stdc++.h>
using namespace std;
long long int l, r, sum = 0, tempVariable, doneTillHereInArrayOfNumbers = 3;
long long int arrayOfNumbers[100000];
long long int createNextLuckyNumber() {
  if (doneTillHereInArrayOfNumbers % 2 == 0) {
    arrayOfNumbers[doneTillHereInArrayOfNumbers] =
        (arrayOfNumbers[doneTillHereInArrayOfNumbers / 2 - 1] * 10) + 7;
  } else {
    arrayOfNumbers[doneTillHereInArrayOfNumbers] =
        (arrayOfNumbers[doneTillHereInArrayOfNumbers / 2] * 10) + 4;
  }
  return arrayOfNumbers[doneTillHereInArrayOfNumbers++];
}
long long int FirstLuckyNumberGreaterThanOrEqualToL() {
  if (4 < l) {
    goto down;
  }
  if (4 >= l && 4 <= r) {
    sum += 4 * (4 - l + 1);
    l = 5;
  } else if (4 >= l && 4 > r) {
    sum += 4 * (r - l + 1);
    l = r;
    cout << sum;
    exit(0);
  }
down:
  if (7 < l) {
    goto down2;
  }
  if (7 >= l && 7 <= r) {
    sum += 7 * (7 - l + 1);
    l = 8;
  } else if (7 >= l && 7 > r) {
    sum += 7 * (r - l + 1);
    cout << sum;
    exit(0);
  }
down2:
  long long int num = 0;
  while (num < l) {
    num = createNextLuckyNumber();
  }
  return num;
}
int main() {
  cin >> l >> r;
  arrayOfNumbers[1] = 4;
  arrayOfNumbers[2] = 7;
  tempVariable = FirstLuckyNumberGreaterThanOrEqualToL();
  if (tempVariable <= r) {
    sum += tempVariable * (tempVariable - l + 1);
    l = tempVariable;
  } else {
    sum += tempVariable * (r - l + 1);
    cout << sum;
    exit(0);
  }
  l++;
  while (l <= r) {
    tempVariable = createNextLuckyNumber();
    if (tempVariable <= r) {
      sum += tempVariable * (tempVariable - l + 1);
      l = tempVariable;
    } else {
      sum += tempVariable * (r - l + 1);
      break;
    }
    l++;
  }
  cout << sum;
  return 0;
}
