QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22563. Summing Sums

Statistics

The $N$ $(1 \le N \le 50,000)$ cows, conveniently numbered 1..$N$, are trying to learn some encryption algorithms. After studying a few examples, they have decided to make one of their own! However, they are not very experienced at this, so their algorithm is very simple:

Each cow $i$ is given a starting number $C_i$ $(0 \le C_i < 90,000,000)$, and then all the cows perform the following process in parallel:

  • First, each cow finds the sum of the numbers of the other $N-1$ cows.
  • After all cows are finished, each cow replaces her number with the sum she computed. To avoid very large numbers, the cows will keep track of their numbers modulo 98,765,431.

They told Canmuu the moose about it in November; he was quite impressed.

Then one foggy Christmas Eve, Canmuu came to say:

"Your algorithm is too easy to break! You should repeat it $T$ $(1 \le T \le 1,414,213,562)$ times instead."

Obviously, the cows were very frustrated with having to perform so many repetitions of the same boring algorithm, so after many hours of arguing, Canmuu and the cows reached a compromise: You are to calculate the numbers after the encryption is performed!

*Some extra feedback will be provided for the first 10 submissions to this problem.

Input

Read the input from standard input.

  • Line 1: Two space-separated integers: $N$ and $T$
  • Lines $2..N+1$: Line $i+1$ contains a single integer: $C_i$

Output

Write the output to standard output.

  • Lines $1..N$: Line $i$ contains a single integer representing the number of cow $i$ (modulo 98,765,431) at the end of the encryption.

Examples

Input 1

3 4
1
0
4

Output 1

26
25
29

Three cows, with starting numbers 1, 0, and 4; four repetitions of the encryption algorithm.

The following is a table of the cows' numbers for each turn:

          Cows' numbers
Turn    Cow1  Cow2  Cow3
 0        1     0     4
 1        4     5     1
 2        6     5     9
 3       14    15    11
 4       26    25    29

Problem credits: Neal Wu, 2007

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.