Problem G
The Maximum Term
Input: Standard Input

Output: Standard Output

According to multinomial theorem we can write:

 

 

When the value of k is 4 and the four variables within the bracket are w, x, y and z we get tetranomial theorem which can be written as

 


You can see that right hand side of this equation is a summation of many terms. If the values of w, x, y, z and n are given, then all these terms will have a value. In this problem your job is to find the value of the term with maximum value.

Input

The input file contains at most 300 lines of input.

Each line contains five integers n (5≤n≤300), w, x, y, z (0<w, x, y, z<301). These five integers are the values of the five parameters of the tetranomial theorem above.

Input is terminated by a line where the value of all five parameters are zero. This line should not be processed.

Output

For each line of input produce one line of output. This line contains at most eight digits. These eight digits are the eight least significant digits (excluding the trailing zeroes) of the value of the highest valued term. If the number is too small to have eight such digits print all that are available (excluding the trailing zeroes).  

 

Sample Input                                Output for Sample Input

8 2 2 2 2
100 20 20 20 20
250 1 2 3 4   
6 10 10 10 10

0 0 0 0 0

64512
74049024
89901568
18
 

 


Problem setter: Shahriar Manzoor

Special Thanks: Monirul Hasan