For a natural number and a prime number , let \deg_p(m) denote the exponent of in the canonical prime factorization of .
You are given a natural number and a prime number . Find the remainder of \dfrac{n!}{p^{\deg_p(n!)}} upon division by p^4.
In other words, divide by as many times as possible, then compute the result modulo p^4.
The number is given in base notation:
where d_{L-1}, d_{L-2}, \dots, d_1, d_0 are nonnegative integers less than (the digits of in base representation).
The first line contains the prime number (3 < p < 55000) and the natural number (L \le 500000), where is the length of the base- representation of .
The second line contains d_{L-1}, d_{L-2}, \dots, d_1, d_0 separated by spaces, with d_{L-1} > 0.
Print the answer to the task.
Example 1