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 T, len, a[20], num[20];
bool vis[20][40][4][2], yet[20][2];
long long n, k, inf[20], f[20][40][4][2];
bool J(int x) { return x == 4 || x == 7; }
int count(int x) {
  int s = 0;
  for (; x; x /= 10) s += J(x % 10);
  return s;
}
long long get(int o, int t1, int t2, int r) {
  if (vis[o][t1 + 11][t2 + 2][r]) return f[o][t1 + 11][t2 + 2][r];
  long long &now = f[o][t1 + 11][t2 + 2][r];
  now = inf[len - o + 3];
  if (o > len && t1 == 0) {
    if (t2 == 1) now = 3;
    if (t2 == -1) now = 5;
    if (t2 == -2 || t2 == 0) now = !r;
    return now;
  }
  if (o > len && t1 > 0) return now;
  if (o > len + 2) return now;
  vis[o][t1 + 11][t2 + 2][r] = 1;
  for (int i = 0; i <= 9; i++) {
    int nr = (i > a[o] || (i == a[o] && r));
    if (o > len && t1 < 0 && !J(i)) continue;
    if (t2 == -2)
      now = min(get(o + 1, t1 - J(i) + J(a[o]), t2, nr) * 10 + i, now);
    if (t2 == -1) {
      if (J(i))
        now = min(get(o + 1, t1 - J(i) + J(a[o]), -2, nr) * 10 + i, now);
      else if (i == 9)
        now = min(get(o + 1, t1 - J(i) + J(a[o]), t2, nr) * 10 + i, now);
    }
    if (t2 == 1) {
      if (i < 9 && J(i + 1))
        now = min(get(o + 1, t1 - J(i) + J(a[o]), -2, nr) * 10 + i, now);
      if (i == 9)
        now = min(get(o + 1, t1 - J(i) + J(a[o]), t2, nr) * 10 + i, now);
    }
    if (t2 == 0) {
      if (i < 9 && !J(i) && !J(i + 1))
        now = min(get(o + 1, t1 - J(i) + J(a[o]), -2, nr) * 10 + i, now);
      if (i == 9)
        now = min(get(o + 1, t1 - J(i) + J(a[o]), t2, nr) * 10 + i, now);
    }
  }
  return now;
}
long long dfs(int o, long long k) {
  if (o > len) return 1;
  long long now(inf[len - o + 3]);
  if (k < 10) {
    for (int i = 0; i <= 9; i++) {
      int ok = 1, t1 = -2, t2 = -2;
      if (i == a[o]) continue;
      for (int j = 0; j < k && k; j++) {
        int x = i + j, y = a[o] + j;
        if (x < 10) {
          if (t1 == -2)
            t1 = J(y % 10) - J(x) + count(num[o + 1] + y / 10) -
                 count(num[o + 1]);
          else if (t1 != J(y % 10) - J(x) + count(num[o + 1] + y / 10) -
                             count(num[o + 1]))
            ok = 0;
        } else {
          if (t2 == -2)
            t2 = J(y % 10) - J(x % 10) + count(num[o + 1] + y / 10) -
                 count(num[o + 1]) - t1;
          else if (t2 != J(y % 10) - J(x % 10) + count(num[o + 1] + y / 10) -
                             count(num[o + 1]) - t1)
            ok = 0;
        }
      }
      if (ok)
        now = min(get(o + 1, t1, t2, (i > a[o] || i == a[o])) * 10 + i, now);
    }
  }
  long long t = dfs(o + 1, 1 + (k + a[o] - 1) / 10);
  now = min(t * 10 + a[o], now);
  return now;
}
void init() {
  inf[0] = 1;
  for (int i = 1; i <= 19; i++) inf[i] = inf[i - 1] * 10;
  memset(num, 0, sizeof(num));
  memset(f, 0, sizeof(f));
  memset(vis, 0, sizeof(vis));
  memset(a, 0, sizeof(a));
}
int cl(long long x) {
  int t = 0;
  for (; ++t, x /= 10;)
    ;
  return t;
}
int main() {
  T = 1;
  while (T--) {
    init();
    scanf(
        "%I64d"
        "%I64d",
        &n, &k);
    for (len = 0; a[++len] = n % 10, num[len] = n, n /= 10;)
      ;
    len = max(cl(k), len);
    printf(
        "%I64d"
        "\n",
        dfs(1, k));
  }
  return 0;
}
