Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

F. Restore a Number

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputVasya decided to pass a very large integer *n* to Kate. First, he wrote that number as a string, then he appended to the right integer *k* — the number of digits in *n*.

Magically, all the numbers were shuffled in arbitrary order while this note was passed to Kate. The only thing that Vasya remembers, is a non-empty substring of *n* (a substring of *n* is a sequence of consecutive digits of the number *n*).

Vasya knows that there may be more than one way to restore the number *n*. Your task is to find the smallest possible initial integer *n*. Note that decimal representation of number *n* contained no leading zeroes, except the case the integer *n* was equal to zero itself (in this case a single digit 0 was used).

Input

The first line of the input contains the string received by Kate. The number of digits in this string does not exceed 1 000 000.

The second line contains the substring of *n* which Vasya remembers. This string can contain leading zeroes.

It is guaranteed that the input data is correct, and the answer always exists.

Output

Print the smalles integer *n* which Vasya could pass to Kate.

Examples

Input

003512

021

Output

30021

Input

199966633300

63

Output

3036366999

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/02/2020 14:11:42 (h3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|