Time limit
2s
Memory limit
128 MB
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.
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.
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.
The second line contains P_0, P_1, ..., P_{N-1}, separated by spaces.
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 <= 101 <= P_i <= 501 <= M <= 50N, P_i, and M are integers.