Plotting Polynomials

No attempts yetTime limit2sMemory limit256 MB

Problem

A graphing calculator draws a function on screen with almost no work from the student. The processor in such a calculator is slow, so the drawing routine has to be economical. This problem asks you to implement a method that speeds up the plotting of a polynomial.

Given a polynomial p(x)=anxn++a1x+a0p(x) = a_n x^n + \dots + a_1 x + a_0 of degree nn, you want to plot it at the mm integer points x=0,1,,m1x = 0, 1, \dots, m-1. Evaluating the polynomial directly at each point costs mnmn multiplications and mnmn additions.

Reusing earlier results cuts that cost. If p(x)=a1x+a0p(x) = a_1 x + a_0 and p(i)p(i) is already known, then p(i+1)=p(i)+a1p(i+1) = p(i) + a_1, so every later value costs one addition.

In general, once the initialization is done, nn additions turn p(i)p(i) into p(i+1)p(i+1). With the constants C0,C1,,CnC_0, C_1, \dots, C_n chosen correctly, the pseudocode below produces p(i)p(i).

p(0) = C_0; t_1 = C_1; ... t_n = C_n;
for i from 1 to m-1 do
     p(i)    = p(i-1)  + t_1;
     t_1     = t_1     + t_2;
     t_2     = t_2     + t_3;
              :
              :
     t_(n-1) = t_(n-1) + t_n;
end

For p(x)=a1x+a0p(x) = a_1 x + a_0 you can take C0=a0C_0 = a_0 and C1=a1C_1 = a_1.

Compute the constants C0,C1,,CnC_0, C_1, \dots, C_n that make the pseudocode give the correct value of p(i)p(i) for every i=0,,m1i = 0, \dots, m-1.

Input

The input is a single line. The first integer is nn, with 1n61 \le n \le 6. It is followed by the n+1n+1 integer coefficients an,,a1,a0a_n, \dots, a_1, a_0. Every coefficient satisfies ai50|a_i| \le 50, and an0a_n \neq 0.

Output

Print C0,C1,,CnC_0, C_1, \dots, C_n on one line, separated by single spaces.