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;
const long long INF = 1000000000000000000;
const long long BLOK = 1000;
int F(long long x) {
  int il = 0;
  while (x != 0) {
    il += (x % 10 == 4) || (x % 10 == 7);
    x /= 10;
  }
  return il;
}
void KMP(vector<int> s, int L, vector<int>& starty) {
  s.push_back(0);
  for (int i = s.size() - 1; i >= 1; --i) s[i] = s[i - 1];
  vector<int> ps(s.size());
  ps[1] = 0;
  for (int i = 2; i < s.size(); ++i) {
    int w = ps[i - 1];
    while (w > 0 && s[w + 1] != s[i]) w = ps[w];
    if (w == 0)
      ps[i] = (s[1] == s[i]) ? 1 : 0;
    else
      ps[i] = w + 1;
    if (ps[i] == L) {
      int nr = i - L + 1 - (L + 2);
      if (s.size() == 2 * BLOK + L + 2) {
        if (nr < 1000 && nr + L - 1 >= 1000) starty.push_back(nr);
      } else
        starty.push_back(nr);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  long long a, b, l;
  long long A, B, L;
  cin >> a >> l;
  b = a + l - 1;
  A = a / BLOK;
  B = b / BLOK;
  L = B - A + 1;
  if (L >= 3 || (L == 2 && (a % BLOK == 0 || (b + 1) % BLOK == 0)) ||
      (L == 1 && a % BLOK == 0 && (b + 1) % BLOK == 0)) {
    vector<int> s(12000000 + L + 1);
    for (int i = 0; i < L; ++i) s[i] = F(BLOK * (i + A));
    s[L] = 100;
    for (int i = 0; i < 12000000; ++i) s[i + L + 1] = F(BLOK * i);
    vector<int> starty;
    KMP(s, L, starty);
    for (int i = 0; i < starty.size(); ++i) {
      if (starty[i] > A) {
        cout << starty[i] * BLOK + a % BLOK;
        return 0;
      }
    }
  } else {
    vector<int> s(12000000);
    for (int i = 0; i < 12000000; ++i) s[i] = F(BLOK * i);
    vector<int> wzo(l);
    for (int i = 0; i < l; ++i) wzo[i] = F(i + a);
    vector<int> pod(BLOK);
    for (int i = 0; i < BLOK; ++i) pod[i] = F(i);
    long long odp = INF;
    for (int i = 0; i <= 10; ++i) {
      for (int j = 0; j <= 10; ++j) {
        vector<int> t(2 * BLOK + l + 1);
        for (int k = 0; k < l; ++k) t[k] = wzo[k];
        t[l] = 100;
        for (int k = 0; k < BLOK; ++k) t[k + l + 1] = pod[k] + i;
        for (int k = 0; k < BLOK; ++k) t[k + BLOK + l + 1] = pod[k] + j;
        vector<int> starty;
        KMP(t, l, starty);
        if (starty.size() == 0) continue;
        long long odp2 = INF;
        for (int k = A; odp2 == INF && k < 12000000 - 1; ++k)
          if (s[k] == i && s[k + 1] == j)
            for (int m = 0; m < starty.size(); ++m)
              if (k * BLOK + starty[m] > a)
                odp2 = min(odp2, k * BLOK + starty[m]);
        odp = min(odp, odp2);
      }
    }
    for (int i = 0; i <= 10; ++i) {
      vector<int> t(BLOK + l + 1);
      for (int j = 0; j < l; ++j) t[j] = wzo[j];
      t[l] = 100;
      for (int j = 0; j < BLOK; ++j) t[j + l + 1] = pod[j] + i;
      vector<int> starty;
      KMP(t, l, starty);
      if (starty.size() == 0) continue;
      long long odp2 = INF;
      for (int j = A; odp2 == INF && j < 12000000; ++j)
        if (s[j] == i)
          for (int k = 0; k < starty.size(); ++k)
            if (j * BLOK + starty[k] > a)
              odp2 = min(odp2, j * BLOK + starty[k]);
      odp = min(odp, odp2);
    }
    cout << odp;
  }
  return 0;
}
