Electronic lock
Kowalski decided to make an electronic lock on his new invention. The lock is a sequence of 7-segment indicators. However, he did not add a full panel for entering numbers, so not all numbers can be used in the password. For the password on the lock, Kowalski wants to use some integer without leading zeros.
Kowalski can't read, but he can count. Therefore, he wants exactly n segments (single segments that make up 7-segment indicators) to light up when entering a password. Also, Kowalski does not want his password to be picked up too quickly, so among all the suitable passwords, he wants to find the one that matches the maximum number.
Help Kowalski find the right number. It is guaranteed that at least one suitable password exists.
Input
The first line contains two integers n and m (2 ≤ n ≤ 10^5
, 1 ≤ m ≤ 10) - the required number of burning segments when displaying the number and the number of available digits. The next line contains m digits in ascending order that can be used.
Output
Print one number - the desired password. It must not contain leading zeros. It is guaranteed that at least one suitable password always exists.