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 i, j, k, n, m;
int a[100], p10[20], p1[20];
inline int cal(int x) {
  int s = 0;
  for (; x; x /= 10) s += x % 10 == 4 || x % 10 == 7;
  return s;
}
inline int xia(int x) {
  int A = x % 10;
  if (A < 3 || A == 5 || A == 8) return x + 1;
  if (A == 3 || A == 6) return x + 2;
  if (A == 4) return x + 3;
  int s = 0;
  for (; x % 10 == 7; x /= 10) s++;
  if (x % 10 == 4) return (x + 3) * p10[s] + p1[s] * 4;
  int s1 = cal(x);
  int y = x + 1;
  if (s1 == cal(y)) return y * p10[s] + p1[s] * 4;
  if (s1 == cal(y) + 1) return y * p10[s] + p1[s + 1] * 4;
  if (s1 == cal(y) - 1) {
    if (s)
      return y * p10[s] + p1[s - 1] * 4;
    else {
      for (; y % 10 == 0;) y /= 10, s++;
      return (y + 1) * p10[s];
    }
  }
}
int dfs(int x, int y) {
  if (y == 1) return xia(x);
  int an = dfs(x / 10, (x + y - 1) / 10 - x / 10 + 1) * 10 + x % 10;
  if (y >= 10)
    return an;
  else {
    int i, k;
    for (i = 1; i <= y; i++) a[i] = cal(x + i - 1);
    for (k = xia(x); k < an; k = xia(k)) {
      int F = 0;
      for (i = 1; i <= y; i++)
        if (a[i] != cal(k + i - 1)) {
          F = 1;
          break;
        }
      if (!F) return k;
    }
    return an;
  }
}
int main() {
  p10[0] = 1;
  for (i = 1; i <= 19; i++) p10[i] = p10[i - 1] * 10;
  for (i = 1; i <= 19; i++) p1[i] = p1[i - 1] * 10 + 1;
  scanf("%d%d", &n, &m);
  printf("%d\n", dfs(n, m));
  return 0;
}
