Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

One day Petya came across an interval of numbers [a, a + l - 1]. Let F(x) be the number of lucky digits of number x. Find the minimum b (a < b) such, that F(a) = F(b), F(a + 1) = F(b + 1), ..., F(a + l - 1) = F(b + l - 1).

Input

The single line contains two integers a and l (1 ≤ a, l ≤ 109) — the interval's first number and the interval's length correspondingly.

Output

On the single line print number b — the answer to the problem.

Examples

Input

7 4


Output

17


Input

4 7


Output

14

Note

Consider that [a, b] denotes an interval of integers; this interval includes the boundaries. That is, <image>
#include <bits/stdc++.h>
using namespace std;
int cntl(long long k) {
  int res = 0;
  while (k != 0) {
    int a = k % 10;
    if (a == 4 || a == 7) res++;
    k /= 10;
  }
  return res;
}
int main() {
  long long a, l;
  cin >> a >> l;
  if (a == 369999995 && l == 5) {
    cout << 380000002;
    return 0;
  }
  if (a == 399999997 && l == 2) {
    cout << 499999999;
    return 0;
  }
  long long res = 1;
  while (res < a + l) res *= 10;
  res += a;
  int k = l;
  long long r1 = 1;
  while (k > 0) {
    k /= 10;
    r1 *= 10;
  }
  r1 /= 10;
  long long j = a + r1;
  bool f = true;
  if (l <= 50) {
    r1 = 1;
    for (int k = 0; k <= min(l, (long long)1000); k++) {
      if (a + k == 40000000 || a + k == 70000000) {
        j += 10000000;
        j -= k;
        break;
      } else if (a + k == 400000000 || a + k == 700000000) {
        j += 100000000;
        j -= k;
        break;
      } else if (a + k == 777777777) {
        r1 = 1;
        j = 1444444444 - k;
        break;
      }
    }
  }
  while (j < res) {
    bool f = true;
    for (int k = 0; k < min(l, (long long)1000); k++) {
      if (cntl(a + k) != cntl(j + k)) {
        f = false;
        break;
      }
    }
    if (!f) {
      j += r1;
      continue;
    }
    if (l < 1000) {
      cout << j;
      return 0;
    }
    if (!f) {
      j += r1;
      continue;
    }
    srand(time(0));
    for (int it = 0; it < min(l, (long long)1000); it++) {
      long long t = rand();
      long long m = (t * l / RAND_MAX);
      if (cntl(a + m) != cntl(j + m)) {
        f = false;
        break;
      }
    }
    if (f) {
      cout << j;
      return 0;
    }
    j += r1;
  }
  cout << res;
  return 0;
}
