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>
long long min(long long a, long long b) { return a < b ? a : b; }
int abs_(int x) { return x > 0 ? x : -x; }
int count(int a) {
  return a == 0 ? 0 : count(a / 10) + (a % 10 == 4 || a % 10 == 7);
}
int solve_(int a, int k0, int k1) {
  int p, k, l;
  k = count(a);
  p = 1;
  if (a == 0)
    l = 0x7fffffff;
  else {
    l = 0;
    while (a % (p * 10) == 0) p *= 10, l++;
  }
  if (k1 == -1 || k1 == k0 - 1) {
    if (k <= (k1 == -1 ? k0 : k0 - 1) && k0 <= k + l) {
      k0 -= k;
      p = 1;
      while (k0--) a += p * 4, p *= 10;
      return a;
    }
  } else if (k1 == k0) {
    if (k <= k0 && k0 <= k + l - 1) {
      k0 -= k;
      p = 10;
      while (k0--) a += p * 4, p *= 10;
      return a;
    }
  } else {
    if (k <= k0 && k0 <= k + l - 1) {
      a += 3;
      k0 -= k;
      p = 10;
      while (k0--) a += p * 4, p *= 10;
      return a;
    }
  }
  if (count(a + p - 1) == k0 && count(a + p) == k1) return a + p - 1;
  return solve_(a + p, k0, k1);
}
int solve(int a, int l) {
  int r, i, ans;
  if (l >= 30)
    return solve(a / 10, (a + l - 1) / 10 - a / 10 + 1) * 10 + a % 10;
  ans = 0x7fffffff;
  for (r = 0; r < 100; r++) {
    int k0, k1, bad;
    k0 = k1 = -1, bad = 0;
    for (i = 0; i < l; i++) {
      int k = count(a + i) - count((r + i) % 100);
      if (r + i < 100) {
        if (k < 0 || k0 != -1 && k0 != k) {
          bad = 1;
          break;
        }
        k0 = k;
      } else {
        if (k < 0 || k1 != -1 && k1 != k) {
          bad = 1;
          break;
        }
        k1 = k;
      }
    }
    if (bad || k1 != -1 && abs_(k0 - k1) > 1) continue;
    ans = min(ans, (long long)solve_((a - r + 100) / 100, k0, k1) * 100 + r);
  }
  return ans;
}
int main() {
  int a, l;
  scanf("%d%d", &a, &l);
  printf("%d\n", solve(a, l));
  return 0;
}
