Problem11324--[yosupo] Polynomial - Polynomial Root Finding (Mod 998244353)

11324: [yosupo] Polynomial - Polynomial Root Finding (Mod 998244353)

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

Given a polynomial $f(x) = \sum_{i=0}^Nf _ ix^i\in \mathbb{F} _ {998244353}[x]$ of degree $N$. 
Find all $a\in \mathbb{F} _ {998244353}$ satisfying $f(a)=0$.

Input

$N$
$f_0$ $\cdots$ $f_N$

Output

Print all $a$ satisfying $f(a)=0$ in the following format.

$n$
$a_0$ $\cdots$ $a_{n-1}$


$a_i$ should be printed as a non-negative integer less than $998244353$. 
The order in which $a_i$ is output can be arbitrary.

Constraints

- $0\leq N\leq 4,000$
- $0\leq f_i < 998244353$
- $f_N\neq 0$

Sample 1 Input

2
6 998244348 1

Sample 1 Output

2
3 2

Sample 2 Input

2
3 0 1

Sample 2 Output

0

Sample 3 Input

5
1 5 10 10 5 1

Sample 3 Output

1
998244352

10
0 961956353 102657600 880974353 72368000 971311853 6327300 997299353 87000 998239853 100

10
1 3 0 2 4 5 9 8 7 6

HINT

Source/Category