Here, we consider polynomials in , that is, polynomials on whose coefficients are elements of , where is a prime number.
A polynomial is monic if the coefficient of its term with largest degree is . A polynomial is irreducible if it cannot be written as the product of two polynomials of smaller degree. Your task is to count the number of monic, irreducible polynomials of of a given degree .
Too difficult? Do not despair! The problem is not so hard, once you know that, in , every monic polynomial can be written in a unique way as a factor of monic, irreducible polynomials. For instance, in there are monic polynomials of degree (in , all polynomials are monic), but only one of them is irreducible:
In , there are monic polynomials of degree , but only two of them are irreducible:
Input consists of several cases, each with a prime number and an integer number . Additionally, we have .
For every case, print the number of monic, irreducible polynomials in of degree .
Input
2 2 2 3 2 4 2 30 3 2 3 3 3 4 3 19 29 6
Output
1 2 3 35790267 3 8 18 61171656 99133020