#P6202. [USACO07CHN] Summing Sums G

[USACO07CHN] Summing Sums G

Problem Description

NN cows (1N5×1041 \leq N \leq 5 \times 10^4) have just learned a lot about cryptography. At last, they created a cow-only encryption method. Because they lack experience, their encryption method is very simple.

The ii-th cow holds the ii-th digit of the code, which is initially CiC_i (0Ci<9×1070 \leq C_i \lt 9 \times 10^7). During encryption, the ii-th cow computes the sum of the numbers of all other cows, and takes this sum modulo 9876543198\,765\,431. After all cows finish computing, each cow replaces her original number with the number she computed. That is,

Ci=(k=1NCkCi)mod98765431C_{i}'=(\sum_{k=1}^NC_k-C_i) \bmod 98\,765\,431

In this way, they complete one encryption.

In November, the cows told this encryption method to Carmen the moose. After thinking for a while, Carmen said: "Your algorithm is still very primitive. To achieve an encryption effect, you need to repeat this encryption process TT times (1T14142135621 \leq T \leq 1\,414\,213\,562)."

The cows are lazy, so they gave this task to you.

Input Format

The first line contains two integers N,TN, T.

The next NN lines each contain one integer. The ii-th line contains CiC_i.

Output Format

Output NN lines. The ii-th line contains one integer, representing CiC_i after TT encryptions.

3 4
1
0
4
26
25
29

Hint

After each encryption, CiC_i is as follows:

Number of times C1C_1 C2C_2 C3C_3
0 1 0 4
1 4 5 1
2 6 9
3 14 15 11
4 26 25 29

Translated by ChatGPT 5