atcoder#TENKA12019E. Polynomial Divisors

Polynomial Divisors

Score : 800800 points

Problem Statement

You are given a polynomial of degree NN with integer coefficients: f(x)=aNxN+aN1xN1+...+a0f(x)=a_Nx^N+a_{N-1}x^{N-1}+...+a_0. Find all prime numbers pp that divide f(x)f(x) for every integer xx.

Constraints

  • 0N1040 \leq N \leq 10^4
  • ai109(0iN)|a_i| \leq 10^9(0\leq i\leq N)
  • aN0a_N \neq 0
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

aNa_N

::

a0a_0

Output

Print all prime numbers pp that divide f(x)f(x) for every integer xx, in ascending order.

2
7
-7
14
2
7

22 and 77 divide, for example, f(1)=14f(1)=14 and f(2)=28f(2)=28.

3
1
4
1
5

There may be no integers that satisfy the condition.

0
998244353
998244353