spoj#OVICUMSUM. A Cumulative Sum Problem
A Cumulative Sum Problem
Given an array a0 of size n (1 < n < 105). Find the array ak modulo (7340033)
where ak = cumulative summation array of the array ak-1.
Means,
ak[1] = ak-1[1]
for i > 1 , ak[i] = ak[i-1] + ak-1[i]
Given k (0 < k < 105)
Can you find the array ak efficiently?
For example,
If a0 = {1, 2, 1, 3},
a1 = {1, 3, 4, 7}
a2 = {1, 4, 8, 15}
a3 = {1, 5, 13, 28}
Input
First line will contain two integer n, k (size of the array and k from the problem description)
Following n positive integers separated by spaces denoting array a0 .
All integers are smaller than 105.
Output
Output n integers of the array ak with spaces in between.
Example
Input:4 2
1 2 1 3
Output: 1 4 8 15