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>
const int mod = 100000, maxn = 10, maxs = 20;
int cnt[mod], s1[maxn], s2[maxn], f[maxs];
int lucky(int x) { return cnt[x / mod] + cnt[x % mod]; }
int find(int x) {
  int c1, c2;
  switch (x % 10) {
    case 0:
    case 1:
    case 2:
    case 5:
    case 8:
      return x + 1;
    case 3:
    case 6:
      return x + 2;
    case 4:
      return x + 3;
    case 7:
    case 9:
      for (c1 = 0; x % 10 == 7; x /= 10, ++c1)
        ;
      if (x % 10 == 4) return (x + 3) * s2[c1] + s1[c1] * 4;
      c2 = lucky(x++);
      switch (c2 - lucky(x)) {
        case 0:
          return x * s2[c1] + s1[c1] * 4;
        case 1:
          return x * s2[c1] + s1[c1 + 1] * 4;
        case -1:
          if (c1) return x * s2[c1] + s1[c1 - 1] * 4;
          for (; x % 10 == 0; x /= 10, ++c1)
            ;
          return (x + 1) * s2[c1];
      }
  }
}
int solve(int x, int y) {
  if (y == 1) return find(x);
  int ret = solve(x / 10, (x + y - 1) / 10 - x / 10 + 1) * 10 + x % 10;
  if (y >= 20) return ret;
  for (int i = 0; i < y; ++i) f[i] = lucky(x + i);
  for (int cur = find(x); cur < ret; cur = find(cur)) {
    int flag = 1;
    for (int i = 0; i < y && flag; ++i) flag &= f[i] == lucky(cur + i);
    if (flag) return cur;
  }
  return ret;
}
int main() {
  int x, y;
  for (int i = 1; i < mod; ++i)
    cnt[i] = cnt[i / 10] + (i % 10 == 4 || i % 10 == 7);
  s2[0] = 1;
  for (int i = 1; i < maxn; ++i) {
    s1[i] = s1[i - 1] * 10 + 1;
    s2[i] = s2[i - 1] * 10;
  }
  scanf("%d%d", &x, &y);
  printf("%d\n", solve(x, y));
  return 0;
}
