Evaluation

Time Limit: 3000ms
Memory Limit: 65536KB
This problem will be judged on HDU. Original ID: 4656
64-bit integer IO format: %I64d      Java class name: Main

Description

xk=b*c(2k)+d
F(x)=a0 x0+a1 x1+a2 x2+...+an-1 xn-1
Given n, b, c, d, a0, ..., an-1, calculate F(x0), ..., F(xn-1).

Input

There is only one test case.
First line, four integers, n, b, c, d.
Second line, n integers, a0, ..., an-1.

1<=n<=105
1<= b, c, d <=106
0<=ai<=106

Output

n lines. i-th line contains one integer, F(xi-1).
Since the answers may be very large, you should output them modulo 106+3.

Sample Input

2 1 2 3
0 1

Sample Output

4
7

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .