1 #include<cstdio>
2 #include<iostream>
3 #define mod 98765431
4 using namespace std;
5
6 long long arr[100000][3],brr[100000][3],n,t,tot;
7
8 struct MAT{
9 long long mat[10][10];
10 MAT(){
11 for(int i = 0;i < 10;i++)
12 for(int j = 0;j < 10;j++)
13 mat[i][j] = 0;
14 }
15 };
16
17 MAT mul(MAT A,MAT B){
18 MAT C;
19 for(int i = 1;i <= 2;i++)
20 for(int j = 1;j <= 2;j++)
21 for(int k = 1;k <= 2;k++)
22 C.mat[i][j] = (C.mat[i][j]+A.mat[i][k]*B.mat[k][j])%mod;
23 return C;
24 }
25
26 MAT ksm(MAT A,long long k){
27 if(k == 1) return A;
28 MAT B = A; k--;
29 while(k){
30 if(k&1) B = mul(B,A);
31 A = mul(A,A);
32 k >>= 1;
33 }return B;
34 }
35
36 int main(){
37 scanf("%lld%lld",&n,&t);
38 for(int i = 1;i <= n;i++)
39 scanf("%lld",&arr[i][1]);
40 MAT BUF;
41 BUF.mat[1][1] = -1;
42 BUF.mat[1][2] = 0;
43 BUF.mat[2][1] = 1;
44 BUF.mat[2][2] = n-1;
45
46 BUF = ksm(BUF,t);
47
48 for(int i = 1;i <= n;i++) tot += arr[i][1];
49 for(int i = 1;i <= n;i++) arr[i][2] = tot%mod;
50
51 for(int i = 1;i <= n;i++)
52 for(int j = 1;j <= 2;j++)
53 for(int k = 1;k <= 2;k++)
54 brr[i][j] = (brr[i][j]+arr[i][k]*BUF.mat[k][j])%mod;
55
56 for(int i = 1;i <= n;i++)
57 printf("%lld\n",brr[i][1]);
58
59 return 0;
60 }