Polynomial#1847

Polynomial

7 seconds
256 megabytes
Easy

Given a polynomial

P(x) = a_0 + a_1 x + a_2 x^2 + \ldots + a_{n-1} x^{n-1}

specified by the coefficients a_0, a_1, \ldots, a_{n-1}.

Your task is to compute the value of this polynomial modulo for all integer values of from to , inclusive.

Input

The first line contains integers , , and (1 \le n \le 2000, 1 \le k \le 200\,000, 1 \le m \le 10^9).

The second line contains non-negative integers a_0, a_1, \ldots, a_{n-1}, each not exceeding 10^9 — the coefficients of the polynomial.

Output

Output k+1 integers: the remainders of P(0), P(1), \ldots, P(k) when divided by . Output the numbers in increasing order of , separated by spaces.

Examples

Example 1

Loading
Loading