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 rd() { return RAND_MAX == 32767 ? ((rand() << 15) ^ rand()) : rand(); }
const long long inf = 1000000000000000LL;
int a[18], b[18], d[18];
long long f[18][18][2][3];
int lk(int x) { return x == 4 || x == 7; }
int as(int x) {
  if (x == 4 || x == 7) return 0;
  if (x == 3 || x == 6) return 2;
  return 1;
}
long long Power(int x) {
  long long res = 1;
  for (int i = 0; i < x; i++) res *= 10;
  return res;
}
int Calc(long long x) {
  int res = 0;
  for (; x; x /= 10) res += lk(x % 10);
  return res;
}
void Fresh(long long &x, long long y) {
  if (y < x) x = y;
}
long long Do(long long n, int m) {
  memset(d, 0, sizeof(d));
  for (int i = 0; n; i++) {
    d[i] = n % 10;
    n /= 10;
  }
  for (int i = 15; i >= 0; i--)
    for (int j = 0; j <= 15; j++)
      for (int k = 0; k < 2; k++)
        for (int l = 0; l < 3; l++) f[i][j][k][l] = inf;
  for (int o = 0; o <= 9; o++)
    if (o >= d[15]) f[15][lk(o)][o > d[15]][as(o)] = o;
  long long res = inf;
  for (int i = 15; i >= 1; i--)
    for (int j = 0; j <= 15; j++)
      for (int k = 0; k < 2; k++)
        for (int l = 0; l < 3; l++)
          if (f[i][j][k][l] < inf) {
            for (int o = 0; o <= 9; o++)
              if (i > 1) {
                if (!k && o < d[i - 1]) continue;
                int ret;
                if (o < 9)
                  ret = as(o);
                else
                  ret = l;
                Fresh(f[i - 1][j + lk(o)][k || o > d[i - 1]][ret],
                      f[i][j][k][l] * 10 + o);
              } else if (k || o > d[0]) {
                int can = 1;
                for (int i = 0; i < m; i++) {
                  int sum = j + lk((o + i) % 10);
                  if (o + i >= 10) {
                    if (l == 0) sum--;
                    if (l == 2) sum++;
                  }
                  if (sum != b[i]) {
                    can = 0;
                    break;
                  }
                }
                if (can) res = min(res, f[i][j][k][l] * 10 + o);
              }
          }
  return res;
}
int main() {
  int k, n, l;
  cin >> n >> l;
  l--;
  int ret = n;
  for (int i = 0; i < 10; i++) {
    a[i] = ret % 10;
    ret /= 10;
  }
  for (k = 0; Power(k) * 9 <= l; k++)
    ;
  int sum = 0, dig = l / Power(k) + 1;
  for (int i = 0; i < k; i++) sum += lk(a[i]);
  for (int i = 0; i < dig; i++) b[i] = Calc(n + Power(k) * i) - sum;
  if ((l + n % Power(k)) / Power(k) == dig) {
    b[dig] = Calc(n + l) - Calc((n + l) % Power(k));
    dig++;
  }
  long long res = Do(n / Power(k), dig);
  for (int i = k - 1; i >= 0; i--) res = res * 10 + a[i];
  cout << res << endl;
  return 0;
}
