#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
const long long mod = 1e9 + 7;
const long long INF = 1e18;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
bool compare(const pair<long long, long long>& i,
             const pair<long long, long long>& j) {
  return i.second < j.second;
}
long long fact[N];
vector<bool> is_prime(100000, true);
vector<int> prime;
void pre() {
  fact[0] = 1;
  for (long long i = 1; i < N; i++) {
    fact[i] = i * fact[i - 1];
    fact[i] %= mod;
  }
}
long long modexp(long long x, long long n) {
  long long r = 1;
  while (n) {
    if (n & 1) r = (r * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return r % mod;
}
long long modinv(long long x) { return modexp(x, mod - 2); }
long long ncr(long long n, long long r) {
  if (n < r) return 0;
  long long ans =
      (fact[n] % mod * modinv(fact[r]) % mod * modinv(fact[n - r]) % mod) % mod;
  return ans;
}
long long exp(long long x, long long n) {
  long long r = 1;
  while (n) {
    if (n & 1) r = (r * x);
    x = (x * x);
    n >>= 1;
  }
  return r;
}
set<long long> st;
void rec(string s) {
  if (s.size() > 10) return;
  long long num = stoll(s);
  st.insert(num);
  rec(s + "4");
  rec(s + "7");
}
void solve() {
  long long l, r;
  cin >> l >> r;
  rec("4");
  rec("7");
  long long ans = 0;
  for (long long i = l; i <= r; i++) {
    long long next = *(st.lower_bound(i));
    ans += (min(r, next) - i + 1) * next;
    i = next;
  }
  cout << ans << "\n";
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}

### Prompt

Generate a cpp solution to the following problem:

Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

Let next(x) be the minimum lucky number which is larger than or equals x. Petya is interested what is the value of the expression next(l) + next(l + 1) + ... + next(r - 1) + next(r). Help him solve this problem.

Input

The single line contains two integers l and r (1 ≤ l ≤ r ≤ 109) — the left and right interval limits.

Output

In the single line print the only number — the sum next(l) + next(l + 1) + ... + next(r - 1) + next(r).

Please do not use the %lld specificator to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specificator.

Examples

Input

2 7


Output

33


Input

7 7


Output

7

Note

In the first sample: next(2) + next(3) + next(4) + next(5) + next(6) + next(7) = 4 + 4 + 4 + 7 + 7 + 7 = 33

In the second sample: next(7) = 7

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
const long long mod = 1e9 + 7;
const long long INF = 1e18;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
bool compare(const pair<long long, long long>& i,
             const pair<long long, long long>& j) {
  return i.second < j.second;
}
long long fact[N];
vector<bool> is_prime(100000, true);
vector<int> prime;
void pre() {
  fact[0] = 1;
  for (long long i = 1; i < N; i++) {
    fact[i] = i * fact[i - 1];
    fact[i] %= mod;
  }
}
long long modexp(long long x, long long n) {
  long long r = 1;
  while (n) {
    if (n & 1) r = (r * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return r % mod;
}
long long modinv(long long x) { return modexp(x, mod - 2); }
long long ncr(long long n, long long r) {
  if (n < r) return 0;
  long long ans =
      (fact[n] % mod * modinv(fact[r]) % mod * modinv(fact[n - r]) % mod) % mod;
  return ans;
}
long long exp(long long x, long long n) {
  long long r = 1;
  while (n) {
    if (n & 1) r = (r * x);
    x = (x * x);
    n >>= 1;
  }
  return r;
}
set<long long> st;
void rec(string s) {
  if (s.size() > 10) return;
  long long num = stoll(s);
  st.insert(num);
  rec(s + "4");
  rec(s + "7");
}
void solve() {
  long long l, r;
  cin >> l >> r;
  rec("4");
  rec("7");
  long long ans = 0;
  for (long long i = l; i <= r; i++) {
    long long next = *(st.lower_bound(i));
    ans += (min(r, next) - i + 1) * next;
    i = next;
  }
  cout << ans << "\n";
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}

```