K-digit Number Junior#2868

K-digit Number Junior

1 second
8 megabytes
Medium

Let's define a number as a K-digit number if it contains no more than distinct digits in its decimal representation, ignoring any leading zeros.

Given a number , your task is to find the nearest K-digit number to it.

Input

The input consists of a single line with two integers, and , both without leading zeros (1 \leq K \leq 10, 0 \leq x \leq 10^8).

Output

Output a K-digit number such that the absolute difference |y-x| is minimized. If there are multiple such numbers, you may output any one of them.

Examples

Example 1

Loading
Loading