Problem:
Score : 800 points

Problem Statement

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

Constraints

0 \leq N \leq 10^4

|a_i| \leq 10^9(0\leq i\leq N)

a_N \neq 0

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
a_N
:
a_0

Output

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

Sample Input 1

2
7
-7
14

Sample Output 1

2
7

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

Sample Input 2

3
1
4
1
5

Sample Output 2

There may be no integers that satisfy the condition.

Sample Input 3

0
998244353

Sample Output 3

998244353

Solution in C++14 (GCC 5.4.1) (judge verdict: Runtime Error)

#include<bits/stdc++.h>
using namespace std;
using LL = long long;

#define ALL(obj) (obj).begin(),(obj).end()


map< int, int > prime_factor(int n) {
  map< int, int > ret;
  for(int i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main(){
    int N;cin >> N;
    vector<int> vec;
    for(int a = 0;a< N+1;a++){
        int b;cin >> b;
        vec.push_back(b);
    }
    map<int,int> p = prime_factor(vec.back() < 0 ? -1 * vec.back() : vec.back());
    vector<int> ans;
    for(auto w : p){
        LL mod = 0;
        for(int a = 0;a < vec.size();a++){
            mod += vec.at(a) % w.first;
        }
        if(mod % w.first == 0){
            ans.push_back(w.first);
        }
    }
    for(int a : ans){
        cout<<a<<endl;
    }
}