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 T>
inline void read(T& x) {
  bool fu = 0;
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') fu = 1, c = getchar();
  for (x = 0; c > 32; c = getchar()) x = x * 10 + c - '0';
  if (fu) x = -x;
};
template <class T>
inline void read(T& x, T& y) {
  read(x);
  read(y);
}
template <class T>
inline void read(T& x, T& y, T& z) {
  read(x);
  read(y);
  read(z);
}
inline char getc() {
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  return c;
}
int num(int x) {
  int tt = 0;
  for (; x; x /= 10) tt += (x % 10 == 4) || (x % 10 == 7);
  return tt;
}
int getluck(int x) {
  int d = x % 10;
  if (d < 3) return x + 1;
  if (d == 3) return x + 2;
  if (d == 4) return x + 3;
  if (d == 5) return x + 1;
  if (d == 6) return x + 2;
  if (d == 8) return x + 1;
  int nx = num(x);
  int xx = x / 10, xx1 = xx + 1;
  int nxx1 = num(xx1);
  if (d == 9) {
    if (nxx1 == nx) return x + 1;
    if (nxx1 == nx + 1) return getluck(xx) * 10;
    return xx1 * 10 + 4;
  }
  if (d == 7) {
    if (nxx1 == nx) return x + 3;
    if (nxx1 == nx - 1) return x + 7;
    return getluck(xx) * 10 + 4;
  }
}
int tra[111];
bool mat(int a, int l) {
  for (int i = 0; i <= l; i++)
    if (num(a + i) != tra[i]) return 0;
  return 1;
}
int get(int a, int l) {
  if (l == 0) return getluck(a);
  int pos = l / 10;
  if (a % 10 + l % 10 >= 10) pos++;
  int mi = get(a / 10, pos) * 10 + a % 10;
  if (l > 20) return mi;
  for (int i = 0; i <= l; i++) tra[i] = num(a + i);
  for (int b = getluck(a); b < mi; b = getluck(b))
    if (mat(b, l)) return b;
  return mi;
}
int a, l;
int main() {
  cin >> a >> l;
  l--;
  cout << get(a, l) << endl;
  return 0;
}
