Small Number#8349

Small Number

1 second
128 megabytes
Easy

Given positive integer and the set of digits . Find the minimum integer, bigger or equal to , which decimal notation contains the digits from set only. The decimal notation of a number must not contain two consecutive identical digits.

Input

First line contains the set of valid digits in increasing order without spaces and repetitions. Second line contains number (1 \le k \le 10^5).

Output

Print one required number. If the number does not exist, print .

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading