Score : $400$ points
Find the largest integer that can be formed with exactly $N$ matchsticks, under the following conditions:
Input is given from Standard Input in the following format:
$N$ $M$ $A_1$ $A_2$ $...$ $A_M$
Print the largest integer that can be formed with exactly $N$ matchsticks under the conditions in the problem statement.
20 4 3 7 8 4
777773
The integer $777773$ can be formed with $3 + 3 + 3 + 3 + 3 + 5 = 20$ matchsticks, and this is the largest integer that can be formed by $20$ matchsticks under the conditions.
101 9 9 8 7 6 5 4 3 2 1
71111111111111111111111111111111111111111111111111
The output may not fit into a $64$-bit integer type.
15 3 5 4 6
654