Given digit prices and a budget, find the largest possible room number (no leading zero unless it's just 0) that can be bought within the budget.
You want to choose the room number for a new office. To make the room number, you must buy digit plates, and you have M won available.
M
The digits for sale are 0 through N-1, and digit i costs P_i. You may buy the same digit multiple times, and there is always enough stock.
0
N-1
i
P_i
If the room number is not 0, its first digit cannot be 0. Find the largest room number that can be made using at most M won.
The first line contains N.
N
The second line contains P_0, P_1, ..., P_{N-1}, separated by spaces.
P_0, P_1, ..., P_{N-1}
The third line contains M.
Print the largest room number that can be made using at most M won.
The input always allows buying at least one digit.
1 <= N <= 10
1 <= P_i <= 50
1 <= M <= 50