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;
template <class A, class B>
A convert(B x) {
  stringstream ss;
  ss << x;
  A ret;
  ss >> ret;
  return ret;
}
const int oo = ~0u >> 3;
const double eps = 1e-10, pi = acos(-1);
const int ml = 20, mo = 1000000007;
const int fx[8][2] = {{-1, 0},  {1, 0},  {0, -1}, {0, 1},
                      {-1, -1}, {-1, 1}, {1, -1}, {1, 1}};
long long e[ml];
long long a, l, b(0);
int calc(long long x) {
  long long ret(0);
  for (long long i = x; i; i /= 10)
    if ((i % 10) == 4 || (i % 10) == 7) ++ret;
  return ret;
}
long long Prev(long long x) {
  for (long long m = 1;; m *= 10)
    if (((x / m) % 10) == 4 || ((x / m) % 10) == 7)
      return (long long)x + m - (x % m);
  return x;
}
long long Succ(long long x) {
  int m = 0, l = 1;
  do {
    if (e[m] > x)
      if (m >= l)
        return e[m] + (e[l] - 1) / 9 * 4;
      else
        return (e[l] - 1) / 9 * 4;
    if (x / e[m] % 10 < 3 && m >= l)
      return x + e[m] - x % e[m] + (e[l] - 1) / 9 * 4;
    if (x / e[m] % 10 < 4 && m + 1 >= l)
      return x + (4 - x / e[m] % 10) * e[m] - x % e[m] + (e[l - 1] - 1) / 9 * 4;
    if (x / e[m] % 10 < 4 && m >= l)
      return x + (4 - x / e[m] % 10) * e[m] - x % e[m] + (e[l - 1] - 1) / 9 * 4;
    if (x / e[m] % 10 == 4 && m >= l + 1)
      return x + e[m] - x % e[m] + (e[l + 1] - 1) / 9 * 4;
    if (x / e[m] % 10 == 4 && m >= l)
      return x + 3 * e[m] - x % e[m] + (e[l] - 1) / 9 * 4;
    if (x / e[m] % 10 < 7 && m + 1 >= l)
      return x + (7 - x / e[m] % 10) * e[m] - x % e[m] + (e[l - 1] - 1) / 9 * 4;
    if (x / e[m] % 10 == 7)
      if (m >= l + 1)
        return x + e[m] - x % e[m] + (e[l + 1] - 1) / 9 * 4;
      else {
        ++l;
        continue;
      }
    if (x / e[m] % 10 < 9 && m >= l)
      return x + e[m] - x % e[m] + (e[l] - 1) / 9 * 4;
  } while (++m);
}
int main() {
  e[0] = 1;
  for (int i = 1; i <= ml - 1; ++i) e[i] = (long long)e[i - 1] * 10;
  cin >> a >> l;
  int d, m;
  for (d = a + l - 1, m = 1; l >= 10; l /= 10, a /= 10, d /= 10, m *= 10)
    b += (a % 10) * m;
  long long i = a + 1;
  if (calc(i) > calc(a)) i = Prev(i);
  if (calc(i) < calc(a)) i = Succ(i);
  while (1) {
    long long I = i;
    for (long long k = 0; a + k <= d; ++k) {
      int n1 = calc(a + k);
      int n2 = calc(i + k);
      for (int j = 1; j <= n2 - n1; ++j) i = Prev(i + k) - k;
      for (int j = 1; j <= n1 - n2; ++j) i = Succ(i + k) - k;
    }
    if (i == I) {
      b += i * m;
      break;
    }
  }
  cout << b << endl;
}
