11297 - Digits combing   

Description

Given n digits from 0 to 9, you are going to combine them into a decimal number.
For example, if 2 and 9 are given, 29 and 92 are valid numbers.
However no valid number could start with 0 except 0 itself.
For example, if 2 and 0 are given, only 20 is valid while 02 is not.

This problem ask you to find a minimum number that is valid.
Noted that all digits must be used.

Input

The first line contains a integer n. (n<=7)
The next line contains n digits.

 

Output

The minimum number that is valid.

 

Sample Input  Download

Sample Output  Download

Partial Judge Code

11297.c

Partial Judge Header

11297.h

Tags




Discuss