Problem:
Problem C:
One-Dimensional Cellular Automaton
There is a one-dimensional cellular automaton consisting of
N
cells. Cells are numbered from 0 to
N
− 1.
Each cell has a state represented as a non-negative integer less than
M
. The states of cells evolve through discrete time steps. We denote the state of the i-th cell at time t as
S
(
i
,
t
). The state at time
t
+ 1 is defined by the equation
S
(
i
,
t
+ 1) = (
A
×
S
(
i
− 1,
t
) +
B
×
S
(
i
,
t
) +
C
×
S
(
i
+ 1,
t
)) mod
M
,          (1)
where
A
,
B
and
C
are non-negative integer constants. For
i
< 0 or
N
≤
i
, we define
S
(
i
,
t
) = 0.
Given an automaton definition and initial states of cells, your mission is to write a program that computes the states of the cells at a specified time
T
.
Input
The input is a sequence of datasets. Each dataset is formatted as follows.
N M A B C T
S
(0, 0)
S
(1, 0) ...
S
(
N
− 1, 0)
The first line of a dataset consists of six integers, namely
N
,
M
,
A
,
B
,
C
and
T
.
N
is the number of cells.
M
is the modulus in the equation (1).
A
,
B
and
C
are coefficients in the equation (1). Finally,
T
is the time for which you should compute the states.
You may assume that 0 <
N
≤ 50, 0 <
M
≤ 1000, 0 ≤
A
,
B
,
C
<
M
and 0 ≤
T
≤ 10
9
.
The second line consists of
N
integers, each of which is non-negative and less than
M
. They represent the states of the cells at time zero.
A line containing six zeros indicates the end of the input.
Output
For each dataset, output a line that contains the states of the cells at time
T
. The format of the output is as follows.
S
(0,
T
)
S
(1,
T
) ...
S
(
N
− 1,
T
)
Each state must be represented as an integer and the integers must be separated by a space.
Sample Input
5 4 1 3 2 0
0 1 2 0 1
5 7 1 3 2 1
0 1 2 0 1
5 13 1 3 2 11
0 1 2 0 1
5 5 2 0 1 100
0 1 2 0 1
6 6 0 2 3 1000
0 1 2 0 1 4
20 1000 0 2 3 1000000000
0 1 2 0 1 0 1 2 0 1 0 1 2 0 1 0 1 2 0 1
30 2 1 0 1 1000000000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
30 2 1 1 1 1000000000
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
30 5 2 3 1 1000000000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0
Output for the Sample Input
0 1 2 0 1
2 0 0 4 3
2 12 10 9 11
3 0 4 2 1
0 4 2 0 4 4
0 376 752 0 376 0 376 752 0 376 0 376 752 0 376 0 376 752 0 376
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 3 2 2 2 3 3 1 4 3 1 2 3 0 4 3 3 0 4 2 2 2 2 1 1 2 1 3 0

Submitted solutions:

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using a2 = array<ll, 2>;
using a3 = array<ll, 3>;

bool chmin(auto& a, const auto& b) { return a > b ? a = b, 1 : 0; }
bool chmax(auto& a, const auto& b) { return a < b ? a = b, 1 : 0; }

ll mod = 998244353;
const ll INF = 1e18;

ifstream in;
ofstream out;

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    if(argc > 2) {
        in.open(argv[1]);
        cin.rdbuf(in.rdbuf());
        out.open(argv[2]);
        cout.rdbuf(out.rdbuf());
    }

    while(1) {
        ll n, m, a, b, c, t;
        cin >> n >> m >> a >> b >> c >> t;
        if(n == 0) break;
        vector<ll> s(n);
        for(auto& x : s) cin >> x;

        vector<vector<vector<ll>>> mat(31, vector(n, vector<ll>(n, 0)));
        for(int i = 0; i < n; i++) {
            if(i) mat[0][i][i - 1] = a;
            mat[0][i][i] = b;
            if(i + 1 < n) mat[0][i][i + 1] = c;
        }

        auto mul = [&](vector<vector<ll>>& l, vector<vector<ll>>& r) {
            vector<vector<ll>> res(n, vector<ll>(n, 0));
            for(int i = 0; i < n; i++) {
                for(int j = 0; j < n; j++) {
                    for(int k = 0; k < n; k++) {
                        res[i][j] += l[i][k] * r[k][j];
                        res[i][j] %= m;
                    }
                }
            }
            return res;
        };

        for(int i = 1; i <= 30; i++) {
            mat[i] = mul(mat[i - 1], mat[i - 1]);
        }

        vector<vector<ll>> p(n, vector<ll>(n, 0));
        for(int i = 0; i < n; i++) {
            p[i][i] = 1;
        }

        for(int i = 0; i <= 30; i++) {
            if((1 << i) & t) {
                p = mul(p, mat[i]);
            }
        }

        for(int i = 0; i < n; i++) {
            ll ans = 0;
            for(int j = 0; j < n; j++) {
                ans += p[i][j] * s[j];
                ans %= m;
            }
            cout << ans << " \n"[i == n - 1];
        }
    }

    return 0;
}
accuracy: 1
time_ms: 500
memory_kb: 4352
final_rank: 17

code_snippet: #include<bits/stdc++.h>
// #include<atcoder/all>
// #include<boost/multiprecision/cpp_int.hpp>

using namespace std;
// using namespace atcoder;
// using bint = boost::multiprecision::cpp_int;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ve = vector<vector<int>>;
using vb = vector<bool>;
using vvb = vector<vb>;
#define rep(i,s,n) for(ll i = (ll)s;i < (ll)n;i++)
#define rrep(i,l,r) for(ll i = r-1;i >= l;i--)
#define ALL(x) (x).begin(),(x).end()
#define sz(c) ((ll)(c).size())
#define LB(A,x) (int)(lower_bound(A.begin(),A.end(),x)-A.begin())
#define UB(A,x) (int)(upper_bound(A.begin(),A.end(),x)-A.begin())
// #define MOD 1000000007
#define MOD 998244353
template<typename T>using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<typename T>ostream&operator<<(ostream&os,vector<T>&v){for(int i = 0;i < v.size();i++)os<<v[i]<<(i+1!=v.size()?" ":"");return os;}
template<typename T>istream&operator>>(istream&is,vector<T>&v){for(T&in:v)is>>in;return is;}
template<typename T1,typename T2>ostream&operator<<(ostream&os,pair<T1,T2>&p){os<<p.first<<" "<<p.second;return os;}
template<typename T1,typename T2>istream&operator>>(istream&is,pair<T1,T2>&p){is>>p.first>>p.second;return is;}
template<typename T> inline bool chmax(T &a,T b){if(a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a,T b){if(a > b){a = b;return true;}return false;}
ld dist(ld x1,ld y1,ld x2, ld y2){return sqrtl((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}

vvi mul(vvi &a,vvi &b,int mod){
  assert(sz(a));assert(sz(b));
  assert(sz(a[0]) == sz(b));
  int n = sz(a),m = sz(b[0]);
  vvi res(n,vi(m));
  rep(i,0,n)rep(j,0,m)rep(k,0,sz(a[0])){
    (res[i][j] += a[i][k]*b[k][j]%mod)%= mod;
  }
  return res;
}

int main(){
  
  ios_base::sync_with_stdio(0), cin.tie(0);
  while(1){
    ll n,m,T;
    vi coef(3);
    cin >> n >> m >> coef >> T;
    if(!n)break;
    vvi a(n,vi(1));cin >> a;
    vvi mat(n,vi(n));
    rep(i,0,n)rep(j,-1,2){
      int ni = i + j;
      if(ni < 0 || ni >= n)continue;
      mat[ni][i] = coef[1-j];
    }
    while(T){
      if(T & 1)a = mul(mat,a,m);
      T >>= 1;
      mat = mul(mat,mat,m);
    }
    rep(i,0,n)cout << a[i][0] << " \n"[i+1 == n];
  }
  

  return 0;
}
accuracy: 1
time_ms: 1240
memory_kb: 3480
final_rank: 16

code_snippet: #include<iostream>
#include<stdio.h>
#include<cstring>
using namespace std;
const int MAX = 55;
int M;


struct Matrix
{
    int v[MAX][MAX];
};

int n,k;  //分别代表的是每个置换的长度
//置换的一组的个数
//以及一共置换的操作

Matrix mtAdd(Matrix A, Matrix B)        // 求矩阵 A + B
{
    int i, j;
    Matrix C;
    for(i = 0; i < n; i ++)
        for(j = 0; j < n; j ++)
            C.v[i][j]=(A.v[i][j]+B.v[i][j])%M;
    return C;
}

Matrix mtMul(Matrix A, Matrix B)        // 求矩阵 A * B
{
    int i, j, k;
    Matrix C;
    for(i = 0; i < n; i ++)
        for(j = 0; j < n; j ++)
        {
            C.v[i][j] = 0;
            for(k = 0; k < n; k ++)
                C.v[i][j] = (A.v[i][k] * B.v[k][j] + C.v[i][j])%M;
        }
    return C;
}

Matrix mtPow(Matrix A, int k)           // 求矩阵 A ^ k
{
    if(k == 0)
    {
        memset(A.v, 0, sizeof(A.v));
        for(int i = 0; i < n; i ++)
            A.v[i][i] = 1;
        return A;
    }
    if(k == 1) return A;
    Matrix C = mtPow(A, k / 2);
    if(k % 2 == 0)
        return mtMul(C, C);
    else
        return mtMul(mtMul(C, C), A);
}

void out(Matrix A)
{
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
            cout<<A.v[i][j]<<" ";
        cout<<endl;
    }
    cout<<endl;
}

int  main ()
{
   int A,B,C,T;
   Matrix NUM;
   while(~scanf("%d%d%d%d%d%d",&n,&M,&A,&B,&C,&T)){
    if(n==0)  break;
    for(int i=0;i<n;i++){
        scanf("%d",&NUM.v[i][0]);
    }
//out(NUM);
    Matrix yun;
    for(int i=0;i<n;i++){
         if(i-1>=0) yun.v[i][i-1]=A;
          yun.v[i][i]=B;
         if(i-1<n) yun.v[i][i+1]=C;
        }
//out(yun);
    Matrix ans = mtPow(yun,T);
//out(ans);
    NUM=mtMul(ans,NUM);
//out(NUM);
    for(int i=0;i<n-1;i++) printf("%d ",NUM.v[i][0]);
    printf("%d\n",NUM.v[n-1][0]);
    }
}
accuracy: 1
time_ms: 780
memory_kb: 5048
final_rank: 19

code_snippet: #include<bits/stdc++.h>
using namespace std;
int n,m,p,a,b,c,T,w[55];
struct st{
	int v[55][55];
}k[55],ans;
int read(){
	int f=1,ans=0;
	char x=getchar();
	while(x<'0'||x>'9'){
		if(x=='-'){
			f=-1;
		}
		x=getchar();
	}
	while(x>='0'&&x<='9'){
		ans=ans*10+x-'0';
		x=getchar();
	}
	return ans*f;
}
void write(int x){
	char c[10005]={};
	int i=0;
	if(x==0){
		putchar('0');
	}
	if(x<0){
		putchar('-');
		x*=-1;
	}
	while(x){
		c[++i]=x%10;
		x/=10;
	}
	while(i){
		putchar(c[i]+'0');
		i--;
	}
	putchar(' ');
}
void gmnb(int x,int y,int z,st &u,int a[55][55],int b[55][55],int mod){
	int k1[55][55]={};
	for(int i=1;i<=x;i++){
		for(int j=1;j<=z;j++){
			for(int l=1;l<=y;l++){
				k1[i][j]=k1[i][j]+a[i][l]*b[l][j];
				k1[i][j]%=mod;
			}
		}
	}
	for(int i=1;i<=x;i++){
		for(int j=1;j<=z;j++){
			u.v[i][j]=k1[i][j];
		}
	}
}
void lfnb(int x,int y,int mod){
	int cnt=1,r[55][55]={},q=1;
	bool f[55]={};
	while(q<=x){
		q*=2;
		cnt++;
		gmnb(y,y,y,k[cnt],k[cnt-1].v,k[cnt-1].v,mod);
	}
	int cnt1=cnt;
	while(cnt--){
		if(x>=q){
			x-=q;
			f[cnt+1]=1;
		}
		q/=2;
	}
	for(int i=1;i<cnt1;i++){
		if(f[i]){
			gmnb(y,y,y,ans,ans.v,k[i].v,mod);
		}
	}
}
int main(){
	while(1){
		n=read(),m=read(),a=read(),b=read(),c=read(),T=read();
		if(n==0&&m==0&&a==0&&b==0&&c==0&&T==0){
			return 0;
		}
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if(i==j+1){
					k[1].v[i][j]=c;
					ans.v[i][j]=0;
				}else if(i+1==j){
					k[1].v[i][j]=a;
					ans.v[i][j]=0;
				}else if(i==j){
					k[1].v[i][j]=b;
					ans.v[i][j]=1;
				}else{
					k[1].v[i][j]=0;
					ans.v[i][j]=0;
				}
			}
			w[i]=read();
		}
		lfnb(T,n,m);
		for(int i=1;i<=n;i++){
			int h=0;
			for(int j=1;j<=n;j++){
				h+=w[j]*ans.v[j][i];
				h%=m;
			}
                        if (i == n) {printf("%lld", h % m); continue;}
			write(h%m);
		}
		printf("\n");
	}
	return 0;
}
accuracy: 1
time_ms: 800
memory_kb: 3508
final_rank: 11

code_snippet: #include <iostream>
#include <cstdio>
#define ll long long
using namespace std;
#define MAXN 60

int n , m , a , b , c , t;
struct Matrix{
	ll data[MAXN][MAXN];
	int heng , zong;
	void kind3(){
		heng = zong = n;
		for( int i = 1 ; i < MAXN ; i++ )
			for( int j = 1 ; j < MAXN ; j++ )
				data[i][j] = 0;
	}
	void kind4(){
		kind3();
		for( int i = 1 ; i <= n ; i++ )
			data[i][i] = 1;
	}
	
	void kind2(){
		kind3();
		heng = zong = n;
		for( int i = 1 ; i <= n ; i++ ){
			if(i>1) data[i][i-1] = a;
			data[i][i] = b;
			if(i<n) data[i][i+1] = c;
		}
	}
	void print(){
		cout << "[Martix] " << heng << " " << zong << endl;
		for( int i = 1 ; i <= zong ; i++ ){
			for( int j = 1 ; j <= heng ; j++ )
				cout << data[i][j] << " ";
			cout << endl;
		}
	}
};
Matrix get0(){
	Matrix m1;
	m1.kind3();
	return m1;
}
Matrix get1(){
	Matrix m1;
	m1.kind4();
	return m1;
}
Matrix operator*( Matrix m1 , Matrix m2 ){
	Matrix m3; m3.kind3();
	for( int i = 1 ; i <= n ; i++ )
		for( int j = 1 ; j <= m2.heng ; j++ ){
			m3.data[i][j] = 0;
			for( int k = 1 ; k <= n ; k++ ){
				m3.data[i][j] += m1.data[i][k] * m2.data[k][j];
				m3.data[i][j] %= m;
			}
		}
	return m3;
}
Matrix pow( Matrix a , int b ){
	Matrix ret; ret = get1();
	Matrix now; now = a;
	while( b ){
		if( b & 1 ) ret = ret * now;
		now = now * now;
    	b = b >> 1;
	}
	return ret;
}
/*
BC
 ABC
  ABC
  ...
   AB
*/
int main(){
	//freopen("C.txt","r",stdin);
	bool fir = 1;
	while( 1 ){
		scanf("%d %d %d %d %d %d",&n,&m,&a,&b,&c,&t);
		if( !fir ){
			putchar('\n');
		}else fir = 0;
		if( n == 0 ) return 0;
		//cout << n << " " << m << " " << a << " " << b << " " << c << " " << t << endl;
		Matrix A; A.kind2();
		Matrix B; B.kind3(); B.heng = 1; B.zong = n;
		Matrix C; C.kind3();
		for( int i = 1 ; i <= n ; i++ ){
			scanf("%lld",&B.data[i][1]);
		}
		//B.print();
		//Matrix AA = A;
		//A.print();
		A = pow(A,t);
		//A.print();
		//AA = AA*AA;
		//AA.print();
		//cout << "[Main] \"^\" Done" << endl;
		C = A*B;
		for( int i = 1 ; i < n ; i++ )
			printf("%lld ",C.data[i][1]%m);
		printf("%lld",C.data[n][1]%m);
		//return 0;
	}
	return 0;
}
accuracy: 1
time_ms: 1360
memory_kb: 3932
final_rank: 18

code_snippet: #include <bits/stdc++.h>


using namespace std;
//make -f ../makefile SRC=
/*
*/


//------------------------------------------------------------------------------
bool DEBUG = false;
static int64_t MOD = 998244353L;

const int MAX_N = 50;
static int64_t X0[MAX_N];
//------------------------------------------------------------------------------
typedef vector<vector<int64_t> > MAT;
typedef vector<int64_t> VEC;

//------------------------------------------------------------------------------
class Matrix
{
    public:
    int N;
    MAT data;

    Matrix(int size): N(size)
    {
        data.resize(N);
        for (int i=0; i<N; ++i) data[i].resize(N);
        for (int i=0; i<N; i++) for (int j=0; j<N; j++) data[i][j] = 0;
    }

    Matrix(const MAT& values): N(values.size()), data(values)
    {
    
    }

    static Matrix identity(int size)
    {
        MAT values(size, vector<int64_t>(size, 0));
        for (int i=0; i<size; ++i) values[i][i] = 1L;
        return Matrix(values);
    }

    static Matrix zero(int size)
    {
        MAT values(size, vector<int64_t>(size, 0L));
        return Matrix(values);
    }

    Matrix operator*(const Matrix& M1) const
    {
        Matrix R(N);
        for (int i=0; i<N; i++)
            for (int j=0; j<N; j++)
                for (int k=0; k<N; k++)
                    {
                        R.data[i][j] += data[i][k] * M1.data[k][j];
                        if (R.data[i][j] >= MOD) R.data[i][j] %= MOD;
                    }
        return R;

    }

    VEC operator*(const VEC& X) const
    {
        VEC Y(N, 0); //<----------
        for (int i=0; i<N; i++)
            for (int j=0; j<N; j++)
                {
                    Y[i] += data[i][j] * X[j];
                    if (Y[i] >= MOD) Y[i] %= MOD;
                }
        return Y;
    }

    static
    Matrix power(Matrix& A, int64_t x)
    {
        int N = A.N;
        Matrix R = identity(N);
        //int iterations = 3;
        //while (x > 0 && iterations--)
        while (x > 0)
        {
            if (x%2 == 1) R = R * A;
            A = A * A;
            x /= 2;
        }



        return R;
    }


    void debug()
    {
        for (int i=0; i<N; i++)
        {
            for (int j=0; j<N; j++) printf("%ld ",data[i][j]); printf("\n");
        }
        printf("\n");
    }
};

//------------------------------------------------------------------------------
void vec_debug(const VEC& v)
{
    int N = v.size();
    for (int i=0; i<N; ++i)
    {
        printf("%ld", v[i]);
        if (i < N-1) printf(" ");
    }
    printf("\n");
}

//------------------------------------------------------------------------------
void solve(int N, int64_t M, int64_t A, int64_t B, int64_t C, int64_t K)
{
    MOD = M;

    VEC x(N);
    for (int i=0; i<N; ++i) x[i] = X0[i];
    if (K == 0)
    {
        vec_debug(x);
        return;
    }

    MAT data(N, VEC(N, 0));
    for (int m=0; m<N; ++m)
    {
        if (m-1 >= 0) data[m][m-1] = A;
        data[m][m] = B;
        if (m+1 < N) data[m][m+1] = C;
    }
    Matrix Mat1(data);
    Matrix Mat2 = Matrix::power(Mat1, K);
    VEC y = Mat2*x;
    vec_debug(y);
}
//------------------------------------------------------------------------------
void test()
{
}
//------------------------------------------------------------------------------
int main()
{
    //DEBUG = true;
    //test(); return 0;
    //--------------------------------------------------------------------------
    int N, num;
    int64_t M, A, B, C, K;
    while (true)
    {
        num = scanf("%d %ld %ld %ld %ld %ld ", &N, &M, &A, &B, &C, &K);
        if (N == 0 && M == 0 && A == 0 && B == 0 && C == 0 && K == 0) break;

        for (int i=0; i<N; ++i)
        {
            num = scanf("%ld ", &X0[i]);
            //if (X0[i] >= MOD) X0[i] %= MOD;
        }

        solve(N, M, A, B, C, K);
    }
    //--------------------------------------------------------------------------
    return 0;
}
//------------------------------------------------------------------------------
accuracy: 1
time_ms: 960
memory_kb: 3480
final_rank: 14

code_snippet: #include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) sort(ALL(v)), (v).erase(unique(ALL(v)), (v).end())
#define SZ(v) (int)v.size()
#define MIN(v) *min_element(ALL(v))
#define MAX(v) *max_element(ALL(v))
#define LB(v, x) int(lower_bound(ALL(v), (x)) - (v).begin())
#define UB(v, x) int(upper_bound(ALL(v), (x)) - (v).begin())

using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long;
using i128 = __int128_t;
using u128 = __uint128_t;
const int inf = 0x3fffffff;
const ll INF = 0x1fffffffffffffff;

template <typename T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T, typename U> T ceil(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U> T floor(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T> int popcnt(T x) {
    return __builtin_popcountll(x);
}
template <typename T> int topbit(T x) {
    return (x == 0 ? -1 : 63 - __builtin_clzll(x));
}
template <typename T> int lowbit(T x) {
    return (x == 0 ? -1 : __builtin_ctzll(x));
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "P(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
#ifdef LOCAL
#define show(...) _show(0, #__VA_ARGS__, __VA_ARGS__)
#else
#define show(...) true
#endif
template <typename T> void _show(int i, T name) {
    cerr << '\n';
}
template <typename T1, typename T2, typename... T3>
void _show(int i, const T1 &a, const T2 &b, const T3 &...c) {
    for (; a[i] != ',' && a[i] != '\0'; i++)
        cerr << a[i];
    cerr << ":" << b << " ";
    _show(i + 1, a, c...);
}

#include <unistd.h>

namespace fastio {
static constexpr uint32_t SZ = 1 << 17;
char ibuf[SZ];
char obuf[SZ];
char out[100];
// pointer of ibuf, obuf


uint32_t pil = 0, pir = 0, por = 0;

struct Pre {
    char num[10000][4];
    constexpr Pre() : num() {
        for (int i = 0; i < 10000; i++) {
            int n = i;
            for (int j = 3; j >= 0; j--) {
                num[i][j] = n % 10 | '0';
                n /= 10;
            }
        }
    }
} constexpr pre;

inline void load() {
    memmove(ibuf, ibuf + pil, pir - pil);
    pir = pir - pil + fread(ibuf + pir - pil, 1, SZ - pir + pil, stdin);
    pil = 0;
    if (pir < SZ)
        ibuf[pir++] = '\n';
}

inline void flush() {
    fwrite(obuf, 1, por, stdout);
    por = 0;
}

void rd(char &c) {
    do {
        if (pil + 1 > pir)
            load();
        c = ibuf[pil++];
    } while (isspace(c));
}

void rd(string &x) {
    x.clear();
    char c;
    do {
        if (pil + 1 > pir)
            load();
        c = ibuf[pil++];
    } while (isspace(c));
    do {
        x += c;
        if (pil == pir)
            load();
        c = ibuf[pil++];
    } while (!isspace(c));
}

template <typename T> void rd_real(T &x) {
    string s;
    rd(s);
    x = stod(s);
}

template <typename T> void rd_integer(T &x) {
    if (pil + 100 > pir)
        load();
    char c;
    do
        c = ibuf[pil++];
    while (c < '-');
    bool minus = 0;
    if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
        if (c == '-') {
            minus = 1, c = ibuf[pil++];
        }
    }
    x = 0;
    while ('0' <= c) {
        x = x * 10 + (c & 15), c = ibuf[pil++];
    }
    if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
        if (minus)
            x = -x;
    }
}

void rd(int &x) {
    rd_integer(x);
}
void rd(ll &x) {
    rd_integer(x);
}
void rd(i128 &x) {
    rd_integer(x);
}
void rd(uint &x) {
    rd_integer(x);
}
void rd(ull &x) {
    rd_integer(x);
}
void rd(u128 &x) {
    rd_integer(x);
}
void rd(double &x) {
    rd_real(x);
}
void rd(long double &x) {
    rd_real(x);
}

template <class T, class U> void rd(pair<T, U> &p) {
    return rd(p.first), rd(p.second);
}
template <size_t N = 0, typename T> void rd_tuple(T &t) {
    if constexpr (N < std::tuple_size<T>::value) {
        auto &x = std::get<N>(t);
        rd(x);
        rd_tuple<N + 1>(t);
    }
}
template <class... T> void rd(tuple<T...> &tpl) {
    rd_tuple(tpl);
}

template <size_t N = 0, typename T> void rd(array<T, N> &x) {
    for (auto &d : x)
        rd(d);
}
template <class T> void rd(vector<T> &x) {
    for (auto &d : x)
        rd(d);
}

void read() {}
template <class H, class... T> void read(H &h, T &...t) {
    rd(h), read(t...);
}

void wt(const char c) {
    if (por == SZ)
        flush();
    obuf[por++] = c;
}
void wt(const string s) {
    for (char c : s)
        wt(c);
}
void wt(const char *s) {
    size_t len = strlen(s);
    for (size_t i = 0; i < len; i++)
        wt(s[i]);
}

template <typename T> void wt_integer(T x) {
    if (por > SZ - 100)
        flush();
    if (x < 0) {
        obuf[por++] = '-', x = -x;
    }
    int outi;
    for (outi = 96; x >= 10000; outi -= 4) {
        memcpy(out + outi, pre.num[x % 10000], 4);
        x /= 10000;
    }
    if (x >= 1000) {
        memcpy(obuf + por, pre.num[x], 4);
        por += 4;
    } else if (x >= 100) {
        memcpy(obuf + por, pre.num[x] + 1, 3);
        por += 3;
    } else if (x >= 10) {
        int q = (x * 103) >> 10;
        obuf[por] = q | '0';
        obuf[por + 1] = (x - q * 10) | '0';
        por += 2;
    } else
        obuf[por++] = x | '0';
    memcpy(obuf + por, out + outi + 4, 96 - outi);
    por += 96 - outi;
}

template <typename T> void wt_real(T x) {
    ostringstream oss;
    oss << fixed << setprecision(15) << double(x);
    string s = oss.str();
    wt(s);
}

void wt(int x) {
    wt_integer(x);
}
void wt(ll x) {
    wt_integer(x);
}
void wt(i128 x) {
    wt_integer(x);
}
void wt(uint x) {
    wt_integer(x);
}
void wt(ull x) {
    wt_integer(x);
}
void wt(u128 x) {
    wt_integer(x);
}
void wt(double x) {
    wt_real(x);
}
void wt(long double x) {
    wt_real(x);
}

template <class T, class U> void wt(const pair<T, U> val) {
    wt(val.first);
    wt(' ');
    wt(val.second);
}
template <size_t N = 0, typename T> void wt_tuple(const T t) {
    if constexpr (N < std::tuple_size<T>::value) {
        if constexpr (N > 0) {
            wt(' ');
        }
        const auto x = std::get<N>(t);
        wt(x);
        wt_tuple<N + 1>(t);
    }
}
template <class... T> void wt(tuple<T...> tpl) {
    wt_tuple(tpl);
}
template <class T, size_t S> void wt(const array<T, S> val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
        if (i)
            wt(' ');
        wt(val[i]);
    }
}
template <class T> void wt(const vector<T> val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
        if (i)
            wt(' ');
        wt(val[i]);
    }
}

void print() {
    wt('\n');
}
template <class Head, class... Tail> void print(Head &&head, Tail &&...tail) {
    wt(head);
    if (sizeof...(Tail))
        wt(' ');
    print(forward<Tail>(tail)...);
}
void __attribute__((destructor)) _d() {
    flush();
}
} // namespace fastio


using fastio::flush;
using fastio::print;
using fastio::read;

inline void first(bool i = true) {
    print(i ? "first" : "second");
}
inline void Alice(bool i = true) {
    print(i ? "Alice" : "Bob");
}
inline void Takahashi(bool i = true) {
    print(i ? "Takahashi" : "Aoki");
}
inline void yes(bool i = true) {
    print(i ? "yes" : "no");
}
inline void Yes(bool i = true) {
    print(i ? "Yes" : "No");
}
inline void No() {
    print("No");
}
inline void YES(bool i = true) {
    print(i ? "YES" : "NO");
}
inline void NO() {
    print("NO");
}
inline void Yay(bool i = true) {
    print(i ? "Yay!" : ":(");
}
inline void Possible(bool i = true) {
    print(i ? "Possible" : "Impossible");
}
inline void POSSIBLE(bool i = true) {
    print(i ? "POSSIBLE" : "IMPOSSIBLE");
}

/**
 * @brief Fast IO
 */

ll N, M, A, B, C, T;

vector<vector<ll>> Mul(vector<vector<ll>>& X, vector<vector<ll>>& Y) {
    int n = X.size(), m = X[0].size(), l = Y[0].size();
    vector<vector<ll>> Z(n,vector<ll>(l,0));
    rep(i,0,n) {
        rep(j,0,m) {
            rep(k,0,l) {
                Z[i][k] += X[i][j] * Y[j][k];
                Z[i][k] %= M;
            }
        }
    }
    return Z;
}

vector<vector<ll>> Pow(vector<vector<ll>>& X, ll K) {
    int n = X.size();
    if (K == 0) {
        vector<vector<ll>> Z(n,vector<ll>(n,0));
        rep(i,0,n) Z[i][i] = 1 % M;
        return Z;
    }
    if (K % 2 == 0) {
        vector<vector<ll>> Z = Pow(X,K/2);
        return Mul(Z,Z);
    }
    vector<vector<ll>> Z = Pow(X,K-1);
    return Mul(Z,X);
}

int main() {
while(1) {
    cin >> N >> M >> A >> B >> C >> T;
    if (N == 0) return 0;
    vector<vector<ll>> F(N,vector<ll>(N,0)), G(N,vector<ll>(1));
    rep(i,0,N) cin >> G[i][0];
    rep(i,0,N) {
        rep(j,-1,2) {
            if (0 <= i+j && i+j < N) {
                if (j==-1) F[i][i+j] = A;
                if (j==0) F[i][i+j] = B;
                if (j==1) F[i][i+j] = C;
            }
        }
    }
    F = Pow(F,T);
    G = Mul(F,G);
    rep(i,0,N) cout << G[i][0] << (i==N-1 ? '\n' : ' ');
}
}
accuracy: 1
time_ms: 880
memory_kb: 3380
final_rank: 9

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, a, b) for(ll i = a; i < b; ++i)
#define rrep(i, a, b) for(ll i = a; i >= b; --i)
constexpr ll inf = 4e18;
struct SetupIO {
    SetupIO() {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout << fixed << setprecision(30);
    }
} setup_io;
struct Barrett {
    explicit Barrett(unsigned int m)
        : _m(m), im((unsigned long long)(-1) / m + 1) {}
    inline unsigned int umod() const {
        return _m;
    }
    inline unsigned int mul(unsigned int a, unsigned int b) const {
        unsigned long long z = a;
        z *= b;
        unsigned long long x = (unsigned long long)(((unsigned __int128)(z)*im) >> 64);
        unsigned int v = (unsigned int)(z - x * _m);
        if(_m <= v) v += _m;
        return v;
    }

   private:
    unsigned int _m;
    unsigned long long im;
};
template <int id>
struct DynamicModint {
    using mint = DynamicModint;
    static int mod() {
        return (int)bt.umod();
    }
    static void set_mod(int m) {
        assert(1 <= m);
        bt = Barrett(m);
    }
    static mint raw(int v) {
        mint a;
        a._v = v;
        return a;
    }
    DynamicModint()
        : _v(0) {}
    template <class T>
    DynamicModint(const T& v) {
        static_assert(is_integral_v<T>);
        if(is_signed_v<T>) {
            long long x = (long long)(v % (long long)(umod()));
            if(x < 0) x += umod();
            _v = (unsigned int)(x);
        } else _v = (unsigned int)(v % umod());
    }
    unsigned int val() const {
        return _v;
    }
    mint& operator++() {
        ++_v;
        if(_v == umod()) _v = 0;
        return *this;
    }
    mint& operator--() {
        if(_v == 0) _v = umod();
        --_v;
        return *this;
    }
    mint operator++(int) {
        mint res = *this;
        ++*this;
        return res;
    }
    mint operator--(int) {
        mint res = *this;
        --*this;
        return res;
    }
    mint& operator+=(const mint& rhs) {
        _v += rhs._v;
        if(_v >= umod()) _v -= umod();
        return *this;
    }
    mint& operator-=(const mint& rhs) {
        _v += mod() - rhs._v;
        if(_v >= umod()) _v -= umod();
        return *this;
    }
    mint& operator*=(const mint& rhs) {
        _v = bt.mul(_v, rhs._v);
        return *this;
    }
    mint& operator/=(const mint& rhs) {
        return *this *= rhs.inv();
    }
    mint operator+() const {
        return *this;
    }
    mint operator-() const {
        return mint() - *this;
    }
    mint pow(long long n) const {
        assert(0 <= n);
        if(n == 0) return 1;
        mint x = *this, r = 1;
        while(1) {
            if(n & 1) r *= x;
            n >>= 1;
            if(n == 0) return r;
            x *= x;
        }
    }
    mint inv() const {
        auto eg = inv_gcd(_v, mod());
        assert(eg.first == 1);
        return eg.second;
    }
    friend mint operator+(const mint& lhs, const mint& rhs) {
        return mint(lhs) += rhs;
    }
    friend mint operator-(const mint& lhs, const mint& rhs) {
        return mint(lhs) -= rhs;
    }
    friend mint operator*(const mint& lhs, const mint& rhs) {
        return mint(lhs) *= rhs;
    }
    friend mint operator/(const mint& lhs, const mint& rhs) {
        return mint(lhs) /= rhs;
    }
    friend bool operator==(const mint& lhs, const mint& rhs) {
        return lhs._v == rhs._v;
    }
    friend bool operator!=(const mint& lhs, const mint& rhs) {
        return lhs._v != rhs._v;
    }
    friend istream& operator>>(istream& in, mint& x) {
        long long a;
        in >> a;
        x = a;
        return in;
    }
    friend ostream& operator<<(ostream& out, const mint& x) {
        return out << x.val();
    }

   private:
    unsigned int _v = 0;
    static Barrett bt;
    inline static unsigned int umod() {
        return bt.umod();
    }
    inline static pair<long long, long long> inv_gcd(long long a, long long b) {
        if(a == 0) return {b, 0};
        long long s = b, t = a, m0 = 0, m1 = 1;
        while(t) {
            const long long u = s / t;
            s -= t * u;
            m0 -= m1 * u;
            swap(s, t);
            swap(m0, m1);
        }
        if(m0 < 0) m0 += b / s;
        return {s, m0};
    }
};
template <int id>
Barrett DynamicModint<id>::bt(998244353);
using modint = DynamicModint<-1>;
using mint = modint;
template <typename T>
struct Matrix {
    Matrix(int h, int w, T val = 0)
        : h(h), w(w), A(h, vector<T>(w, val)) {}
    int H() const {
        return h;
    }
    int W() const {
        return w;
    }
    const vector<T>& operator[](int i) const {
        assert(0 <= i and i < h);
        return A[i];
    }
    vector<T>& operator[](int i) {
        assert(0 <= i and i < h);
        return A[i];
    }
    static Matrix I(int n) {
        Matrix mat(n, n);
        for(int i = 0; i < n; ++i) mat[i][i] = 1;
        return mat;
    }
    Matrix& operator+=(const Matrix& B) {
        assert(h == B.h and w == B.w);
        for(int i = 0; i < h; ++i) {
            for(int j = 0; j < w; ++j) {
                (*this)[i][j] += B[i][j];
            }
        }
        return (*this);
    }
    Matrix& operator-=(const Matrix& B) {
        assert(h == B.h and w == B.w);
        for(int i = 0; i < h; ++i) {
            for(int j = 0; j < w; ++j) {
                (*this)[i][j] -= B[i][j];
            }
        }
        return (*this);
    }
    Matrix& operator*=(const Matrix& B) {
        assert(w == B.h);
        vector<vector<T>> C(h, vector<T>(B.w, 0));
        for(int i = 0; i < h; ++i) {
            for(int k = 0; k < w; ++k) {
                for(int j = 0; j < B.w; ++j) {
                    C[i][j] += (*this)[i][k] * B[k][j];
                }
            }
        }
        A.swap(C);
        return (*this);
    }
    Matrix& pow(long long t) {
        assert(h == w);
        assert(t >= 0);
        Matrix B = Matrix::I(h);
        while(t > 0) {
            if(t & 1ll) B *= (*this);
            (*this) *= (*this);
            t >>= 1ll;
        }
        A.swap(B.A);
        return (*this);
    }
    Matrix operator+(const Matrix& B) const {
        return (Matrix(*this) += B);
    }
    Matrix operator-(const Matrix& B) const {
        return (Matrix(*this) -= B);
    }
    Matrix operator*(const Matrix& B) const {
        return (Matrix(*this) *= B);
    }
    bool operator==(const Matrix& B) const {
        assert(h == B.H() and w == B.W());
        for(int i = 0; i < h; ++i) {
            for(int j = 0; j < w; ++j) {
                if(A[i][j] != B[i][j]) return false;
            }
        }
        return true;
    }
    bool operator!=(const Matrix& B) const {
        assert(h == B.H() and w == B.W());
        for(int i = 0; i < h; ++i) {
            for(int j = 0; j < w; ++j) {
                if(A[i][j] != B[i][j]) return true;
            }
        }
        return false;
    }

   private:
    int h, w;
    vector<vector<T>> A;
};
int main(void) {
    while(true) {
        ll n, m, a, b, c, t;
        cin >> n >> m >> a >> b >> c >> t;
        if(n == 0) break;
        mint::set_mod(m);
        Matrix<mint> vec(n, 1);
        rep(i, 0, n) {
            cin >> vec[i][0];
        }
        Matrix<mint> mat(n, n);
        rep(i, 0, n) {
            if(i > 0) mat[i][i - 1] = a;
            mat[i][i] = b;
            if(i < n - 1) mat[i][i + 1] = c;
        }
        vec = mat.pow(t) * vec;
        rep(i, 0, n) {
            cout << vec[i][0] << " \n"[i + 1 == n];
        }
    }
}
accuracy: 1
time_ms: 240
memory_kb: 3608
final_rank: 6

code_snippet: #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define S second
#define F first
int M;
vector<vector<int>> mul(vector<vector<int>> a, vector<vector<int>> b){
	       int n = a.size();
	       int m = b[0].size();
	       vector<vector<int>> ans(n, vector<int>(m, 0));
	       for(int i = 0; i<n; i++){
	       	    for(int j = 0; j<m; j++){
	       	    	   int sum = 0;
	       	    	   for(int k = 0; k<a[0].size(); k++){
	       	    	   	       sum += a[i][k]*b[k][j]%M;
	       	    	   	       sum %= M;
						  }
						  ans[i][j] = sum;
				   }
		   }
		   return ans;
}
vector<vector<int>> exp(vector<vector<int>> a, int n, vector<vector<int>> unit){
	   auto ans = unit;
	   auto x = a;
	   if(n == 0) return unit;
	   while(n > 0){
	   	     if(n %2 == 1) ans = mul(x, ans);
	   	     x = mul(x, x);
	   	     n/=2;
	   }
	   return ans;
}
void solve(int n, int m, int a, int b, int c, int t){
	
	M = m;
	int arr[n+5];
	for(int i = 0; i<n; i++) cin >> arr[i];
	vector<vector<int>> mt(n, vector<int>(n, 0));
    for(int i = 0; i<n; i++){
    	 mt[i][i] = b;
    	 if(i!=0) mt[i][i-1] = a;
    	 if(i!=n-1) mt[i][i+1] = c;
	}
	vector<vector<int>> unit(n, vector<int>(n, 0));
	for(int i = 0; i<n; i++) unit[i][i] = 1;
	vector<vector<int>> init(n, vector<int>(1, 0));
	for(int i = 0; i<n; i++) init[i][0] = arr[i];
	auto big = exp(mt, t, unit);
	auto ans = mul(big, init);
	for(int i = 0; i<n; i++) {
		if(i < n-1) cout << ans[i][0] << " ";
		else cout << ans[i][0];
	}
	
}
int main(){
	
      while(true){
      	   int n, m, a, b, c, t;
	cin >> n >> m >> a >> b >> c >> t;
	       if(n == 0 && m == 0 && a == 0 && b == 0 && c == 0 && t == 0) break;
	       solve(n, m, a, b, c, t);
	       cout << '\n';
	  } 
	
}
accuracy: 1
time_ms: 850
memory_kb: 3668
final_rank: 15

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;

vector<vector<ll>> operator*(const vector<vector<ll>>& left, const vector<vector<ll>>& right) {
	int ln = left.size(), lm = left[0].size(), rm = right[0].size();
	vector<vector<ll>> result(ln, vector<ll>(rm, 0ll));

	for (int i = 0; i < ln; i++) {
		for (int j = 0; j < rm; j++) {
			for (int k = 0; k < lm; k++) {
				result[i][j] += left[i][k] * right[k][j];
			}
		}
	}

	return result;
}

vector<vector<ll>> operator%(const vector<vector<ll>>& mat, int M) {
	vector<vector<ll>> result(mat.size(), vector<ll>(mat[0].size(), 0ll));

	for (int i = 0; i < mat.size(); i++) {
		for (int j = 0; j < mat[0].size(); j++) {
			result[i][j] = mat[i][j] % M;
		}
	}

	return result;
}

vector<vector<ll>> MatPow(const vector<vector<ll>>& mat, int T, int M) {
	if (T == 0) {
		vector<vector<ll>> id(mat.size(), vector<ll>(mat[0].size(), 0ll));
		for (int k = 0; k < id.size(); k++) id[k][k] = 1;
		return id;
	}

	vector<vector<ll>> mat_half = MatPow(mat, T / 2, M);

	if (T % 2 == 0) {
		return (mat_half * mat_half) % M;
	} else {
		return (mat_half * mat_half * mat) % M;
	}
}

int main(void) {
	while (true) {
		int N, M, A, B, C, T;
		cin >> N >> M >> A >> B >> C >> T;
		if (N == 0) break;
		vector<vector<ll>> S(N, vector<ll>(1, 0ll));
		for (int i = 0; i < N; i++) cin >> S[i][0];

		vector<vector<ll>> mat(N, vector<ll>(N, 0ll));
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (i == j + 1) mat[i][j] = A;
				else if (i == j) mat[i][j] = B;
				else if (i == j - 1) mat[i][j] = C;
			}
		}
		mat = MatPow(mat, T, M);

		S = (mat * S) % M;

		for (int i = 0; i < N; i++) cout << S[i][0] << " \n"[i == N - 1] << flush;
	}

	return 0;
}

/*
			   [ B C 0 .. 0 ]
			   | A B C .. 0 |
	S(t + 1) = | 0 A B .. 0 | * S(t)
			   | : : : :: : |
			   [ 0 0 0 .. B ]
*/
accuracy: 1
time_ms: 100
memory_kb: 3488
final_rank: 2

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;

vector<vector<ll>> operator*(const vector<vector<ll>>& left, const vector<vector<ll>>& right) {
	int ln = left.size(), lm = left[0].size(), rm = right[0].size();
	vector<vector<ll>> result(ln, vector<ll>(rm, 0ll));

	for (int i = 0; i < ln; i++) {
		for (int j = 0; j < rm; j++) {
			for (int k = 0; k < lm; k++) {
				result[i][j] += left[i][k] * right[k][j];
			}
		}
	}

	return result;
}

vector<vector<ll>> operator%(const vector<vector<ll>>& mat, int M) {
	vector<vector<ll>> result(mat.size(), vector<ll>(mat[0].size(), 0ll));

	for (int i = 0; i < mat.size(); i++) {
		for (int j = 0; j < mat[0].size(); j++) {
			result[i][j] = mat[i][j] % M;
		}
	}

	return result;
}

vector<vector<ll>> MatPow(const vector<vector<ll>>& mat, int T, int M) {
	if (T == 0) {
		vector<vector<ll>> id(mat.size(), vector<ll>(mat[0].size(), 0ll));
		for (int k = 0; k < id.size(); k++) id[k][k] = 1;
		return id;
	} else if (T == 1) {
		return mat;
	}

	vector<vector<ll>> mat_half = MatPow(mat, T / 2, M);

	if (T % 2 == 0) {
		return (mat_half * mat_half) % M;
	} else {
		return (mat_half * mat_half * mat) % M;
	}
}

int main(void) {
	while (true) {
		int N, M, A, B, C, T;
		cin >> N >> M >> A >> B >> C >> T;
		if (N == 0) break;
		vector<vector<ll>> S(N, vector<ll>(1, 0ll));
		for (int i = 0; i < N; i++) cin >> S[i][0];

		vector<vector<ll>> mat(N, vector<ll>(N, 0ll));
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (i == j + 1) mat[i][j] = A;
				else if (i == j) mat[i][j] = B;
				else if (i == j - 1) mat[i][j] = C;
			}
		}
		mat = MatPow(mat, T, M);

		S = (mat * S) % M;

		for (int i = 0; i < N; i++) cout << S[i][0] << " \n"[i == N - 1] << flush;
	}

	return 0;
}

/*
			   [ B C 0 .. 0 ]
			   | A B C .. 0 |
	S(t + 1) = | 0 A B .. 0 | * S(t)
			   | : : : :: : |
			   [ 0 0 0 .. B ]
*/
accuracy: 1
time_ms: 90
memory_kb: 3628
final_rank: 3

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;

vector<vector<ll>> operator*(const vector<vector<ll>>& left, const vector<vector<ll>>& right) {
	int ln = left.size(), lm = left[0].size(), rm = right[0].size();
	vector<vector<ll>> result(ln, vector<ll>(rm, 0ll));

	for (int i = 0; i < ln; i++) {
		for (int j = 0; j < rm; j++) {
			for (int k = 0; k < lm; k++) {
				result[i][j] += left[i][k] * right[k][j];
			}
		}
	}

	return result;
}

vector<vector<ll>> operator%(const vector<vector<ll>>& mat, int M) {
	vector<vector<ll>> result(mat.size(), vector<ll>(mat[0].size(), 0ll));

	for (int i = 0; i < mat.size(); i++) {
		for (int j = 0; j < mat[0].size(); j++) {
			result[i][j] = mat[i][j] % M;
		}
	}

	return result;
}

vector<vector<ll>> MatPow(const vector<vector<ll>>& mat, int T, int M) {
	if (T == 0) {
		vector<vector<ll>> id(mat.size(), vector<ll>(mat[0].size(), 0ll));
		for (int k = 0; k < id.size(); k++) id[k][k] = 1;
		return id;
	} else if (T == 1) {
		return mat;
	}

	vector<vector<ll>> mat_half = MatPow(mat, T / 2, M);

	if (T % 2 == 0) {
		return (mat_half * mat_half) % M;
	} else {
		return (((mat_half * mat_half) % M) * mat) % M;
	}
}

int main(void) {
	while (true) {
		int N, M, A, B, C, T;
		cin >> N >> M >> A >> B >> C >> T;
		if (N == 0) break;
		vector<vector<ll>> S(N, vector<ll>(1, 0ll));
		for (int i = 0; i < N; i++) cin >> S[i][0];

		vector<vector<ll>> mat(N, vector<ll>(N, 0ll));
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (i == j + 1) mat[i][j] = A;
				else if (i == j) mat[i][j] = B;
				else if (i == j - 1) mat[i][j] = C;
			}
		}
		mat = MatPow(mat, T, M);

		S = (mat * S) % M;

		for (int i = 0; i < N; i++) cout << S[i][0] << " \n"[i == N - 1] << flush;
	}

	return 0;
}

/*
			   [ B C 0 .. 0 ]
			   | A B C .. 0 |
	S(t + 1) = | 0 A B .. 0 | * S(t)
			   | : : : :: : |
			   [ 0 0 0 .. B ]
*/
accuracy: 1
time_ms: 110
memory_kb: 3676
final_rank: 4

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;

vector<vector<ll>> MatMul(const vector<vector<ll>>& left, const vector<vector<ll>>& right) {
	int ln = left.size(), lm = left[0].size(), rm = right[0].size();
	vector<vector<ll>> result(ln, vector<ll>(rm, 0ll));

	for (int i = 0; i < ln; i++) {
		for (int j = 0; j < rm; j++) {
			for (int k = 0; k < lm; k++) {
				result[i][j] += left[i][k] * right[k][j];
			}
		}
	}

	return result;
}

vector<vector<ll>> MatMod(const vector<vector<ll>>& mat, int M) {
	vector<vector<ll>> result(mat.size(), vector<ll>(mat[0].size(), 0ll));

	for (int i = 0; i < mat.size(); i++) {
		for (int j = 0; j < mat[0].size(); j++) {
			result[i][j] = mat[i][j] % M;
		}
	}

	return result;
}

class {
   private:
	map<int, vector<vector<ll>>> memo_;

	vector<vector<ll>> MatPow(const vector<vector<ll>>& mat, int T, int M) {
		if (T == 0) {
			vector<vector<ll>> id(mat.size(), vector<ll>(mat[0].size(), 0ll));
			for (int k = 0; k < id.size(); k++) id[k][k] = 1;
			return id;
		} else if (T == 1) {
			return mat;
		}

		int T_half = T / 2;
		vector<vector<ll>> mat_half;

		if (memo_.find(T_half) == memo_.end()) {
			mat_half = this->operator()(mat, T_half, M);
			memo_[T_half] = mat_half;
		} else mat_half = memo_[T_half];

		if (T % 2 == 0) {
			return MatMod(MatMul(mat_half, mat_half), M);
		} else {
			return MatMod(MatMul(MatMod(MatMul(mat_half, mat_half), M), mat), M);
		}
	}

   public:
	vector<vector<ll>> operator()(const vector<vector<ll>>& mat, int T, int M) {
		memo_.clear();
		return this->MatPow(mat, T, M);
	}
} MatPow;

int main(void) {
	while (true) {
		int N, M, A, B, C, T;
		cin >> N >> M >> A >> B >> C >> T;
		if (N == 0) break;
		vector<vector<ll>> S(N, vector<ll>(1, 0ll));
		for (int i = 0; i < N; i++) cin >> S[i][0];

		vector<vector<ll>> mat(N, vector<ll>(N, 0ll));
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (i == j + 1) mat[i][j] = A;
				else if (i == j) mat[i][j] = B;
				else if (i == j - 1) mat[i][j] = C;
			}
		}
		mat = MatPow(mat, T, M);

		S = MatMod(MatMul(mat, S), M);

		for (int i = 0; i < N; i++) cout << S[i][0] << " \n"[i == N - 1] << flush;
	}

	return 0;
}

/*
			   [ B C 0 .. 0 ]
			   | A B C .. 0 |
	S(t + 1) = | 0 A B .. 0 | * S(t)
			   | : : : :: : |
			   [ 0 0 0 .. B ]
*/
accuracy: 1
time_ms: 110
memory_kb: 4132
final_rank: 12

code_snippet: // (⁠◕⁠ᴗ⁠◕⁠✿⁠)

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define srep(i, s, n) for (ll i = s; i < (n); i++)
#define len(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
using namespace std;
template<typename T> using vc = vector<T>;
template<typename T> using vv = vc<vc<T>>;
template<typename T> using vvv = vv<vc<T>>;
using vi = vc<int>;using vvi = vv<int>; using vvvi = vv<vi>;
using ll = long long;using vl = vc<ll>;using vvl = vv<ll>; using vvvl = vv<vl>;
using ld = long double; using vld = vc<ld>; using vvld = vc<vld>; using vvvld = vc<vvld>;
using uint = unsigned int;
using ull = unsigned long long;
const ld pi = 3.141592653589793;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
// const ll mod = 1000000007;
const ll mod = 998244353;
inline bool inside(ll y, ll x, ll H, ll W) {return 0 <= (y) and (y) < (H) and 0 <= (x) and (x) < (W); }

#define debug(var)  do{std::cout << #var << " : \n";view(var);}while(0)
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vc<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vv<T>& vv){ for(const auto& v : vv){ view(v); } }

template<typename T> vc<vc<T>> dot(vc<vc<T>> &A, vc<vc<T>> &B, int M){
    vc<vc<T>> ret;
    for (int i = 0; i < len(A); i++){
        vc<T> row;
        for (int j = 0; j < len(B[0]); j++){
            T ele = 0;
            for (int k = 0; k < len(A[0]); k++){
                ele += A[i][k] * B[k][j];
                ele %= M;
            }
            row.push_back(ele);
        }
        ret.push_back(row);
    }
    return ret;
}

template<typename T> vc<vc<T>> multidot(vc<vc<T>> &A, ll N, int M){
    vc<vc<T>> ret(len(A), vc<T>(len(A), 0));
    for (int i = 0; i < len(A); i++) ret[i][i] = 1;
    while (N > 0){
        if (N & 1) ret = dot(ret, A, M);
        A = dot(A, A, M);
        N >>= 1;
    }
    return ret;
}

vi solve(int N, int M, int A, int B, int C, int T){
    vvi S(N, vi(1)); rep(i, N) cin >> S[i][0];
    vvi D(N, vi(N, 0));
    rep(i, N){
        if (i > 0) D[i][i - 1] = A;
        D[i][i] = B;
        if (i < N - 1) D[i][i + 1] = C;
    }
    auto E = multidot(D, T, M);
    auto F = dot(E, S, M);
    vi ans;
    rep(i, N) ans.push_back(F[i][0]);
    return ans;
}

int main(){
    vc<vi> ans;
    while (true){
        int N, M, A, B, C, T; cin >> N >> M >> A >> B >> C >> T;
        if (N == 0 && M == 0 && A == 0 && B == 0 && C == 0 && T == 0) break;
        ans.push_back(solve(N, M, A, B, C, T));
    }
    for (auto x : ans){
        rep(i, len(x)) cout << x[i] << " \n"[i == len(x) - 1];
    }
}
accuracy: 1
time_ms: 850
memory_kb: 3308
final_rank: 8

code_snippet: #include<stdio.h>

char space_or_indent[2] = { ' ', '\n' };

void matCopy( long long A[50][50], long long B[50][50], int size )
{
    for( int i = 0; i < size; i++ )
    {
        for( int j = 0; j < size; j++ )
        {
            A[i][j] = B[i][j];
        }
    }
}

void calMatrix( long long A[50][50], long long B[50][50], long long C[50][50], int size, long long MOD )
{
    long long sum;
    for( int i = 0; i < size; i++ )
    {
        for( int j = 0; j < size; j++ )
        {
            sum = 0;
            for( int k = 0; k < size; k++ )
            {
                sum = ( sum + A[i][k] * B[k][j] ) % MOD;
            }
            C[i][j] = sum;
        }
    }
}

void calPowMatrix( long long A[50][50], int size, int n, long long MOD )
{
    long long tmp[50][50], res[50][50], ans[50][50];
    matCopy( res, A, size );
    for( int i = 0; i < size; i++ )
    {
        for( int j = 0; j < size; j++ )
        {
            ans[i][j] = i == j;
        }
    }

    for( int bit = 0; ( 1 << bit ) <= n; bit++ )
    {
        if( n & ( 1 << bit ) )
        {
            matCopy( tmp, ans, size );
            calMatrix( tmp, res, ans, size, MOD );
        }
        matCopy( tmp, res, size );
        calMatrix( tmp, tmp, res, size, MOD );
    }

    matCopy( A, ans, size );
}

int main( void )
{
    long long N, M, A, B, C, T;
    long long S[50] = { 0 };
    long long matrix[50][50];
    while( 1 )
    {
        scanf( "%lld %lld %lld %lld %lld %lld", &N, &M, &A, &B, &C, &T );
        if( N == 0 && M == 0 && A == 0 && B == 0 && C == 0 && T == 0 ) break;
        for( int i = 0; i < N; i++ )
        {
            scanf( "%lld", &S[i] );
        }
        for( int i = 0; i < N; i++ )
        {
            for( int j = 0; j < N; j++ )
            {
                if( i == j ) matrix[i][j] = B;
                else if( i == j + 1 ) matrix[i][j] = A;
                else if( i + 1 == j ) matrix[i][j] = C;
                else matrix[i][j] = 0;
            }
        }

        calPowMatrix( matrix, N, T, M );

        long long sum;
        for( int i = 0; i < N; i++ )
        {
            sum = 0;
            for( int j = 0; j < N; j++ )
            {
                sum = ( sum + matrix[i][j] * S[j] ) % M;
            }
            printf( "%lld%c", sum, space_or_indent[i == N - 1] );
        }
    }

    return 0;
}
accuracy: 1
time_ms: 1340
memory_kb: 3008
final_rank: 10

code_snippet: #include <bits/stdc++.h>
using namespace std;
constexpr int inf = 1 << 30;
using Matrix = vector<vector<int>>;
int mod;

Matrix matmul(const Matrix& lhs, const Matrix& rhs) {
    int n = lhs.size();
    int m = rhs.size();
    int l = (rhs.front()).size();
    Matrix result(n, vector<int>(l));
    for (int i = 0; i < n; i++) {
        for (int k = 0; k < l; k++) {
            for (int j = 0; j < m; j++) {
                result[i][k] += lhs[i][j] * rhs[j][k];
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < l; j++) {
            result[i][j] %= mod;
        }
    }
    return result;
}

Matrix matpow(Matrix mat, int p) {
    int n = mat.size();
    Matrix result(n, vector<int>(n));
    for (int i = 0; i < n; i++) {
        result[i][i] = 1;
    }
    while (p > 0) {
        if (p & 1) {
            result = matmul(result, mat);
        }
        mat = matmul(mat, mat);
        p >>= 1;
    }
    return result;
}

bool solve() {
    int n, m, t;
    int a[3];
    cin >> n >> m >> a[0] >> a[1] >> a[2] >> t;
    if (n == 0) return false;
    mod = m;
    Matrix dp(n, std::vector<int>(1));
    for (int i = 0; i < n; i++) {
        cin >> dp[i][0];
    }
    Matrix square(n, std::vector<int>(n));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            if (i + j - 1 < 0 || i + j - 1 >= n) continue;
            square[i][i + j - 1] = a[j];
        }
    }
    square = matpow(square, t);
    dp = matmul(square, dp);
    for (int i = 0; i < n; i++) {
        cout << dp[i][0];
        if (i < n - 1) cout << ' '; 
    }
    cout << '\n';
    return true;
}

int main() {
    while (solve());
}
accuracy: 1
time_ms: 110
memory_kb: 3468
final_rank: 1

code_snippet: #include <bits/stdc++.h>
using namespace std;
using Mat = vector<vector<int>>;

int add(int a, int b, int mod) {
    return (a + b) % mod;
}

int mul(int a, int b, int mod) {
    return (a * b) % mod;
}

Mat mul(Mat A, Mat B, int mod) {
    assert(A.size());
    assert(B.size());
    assert(A[0].size() == B.size());
    Mat res(A.size(), vector(B[0].size(), 0));
    for (int i = 0 ; i < (int)A.size() ; i++) {
        for (int j = 0 ; j < (int)B[0].size() ; j++) {
            for (int k = 0 ; k < (int)A[0].size() ; k++) {
                res[i][j] = add(res[i][j], mul(A[i][k], B[k][j], mod), mod);
            }
        }
    }
    return res;
}

Mat pow(Mat A, int p, int mod) {
    assert(A.size());
    assert(A.size() == A[0].size());
    Mat res(A.size(), vector(A.size(), 0));
    for (int i = 0 ; i < (int)A.size() ; i++) res[i][i] = 1;
    while (p) {
        if (p & 1) {
            res = mul(res, A, mod);
        }
        A = mul(A, A, mod);
        p >>= 1;
    }
    return res;
}

void out(Mat A) {
    for (auto arr : A) {
        for (auto x : arr) cout << x << ' ';
        cout << endl;
    }
}

bool solve() {
    int N, M, A, B, C, T; cin >> N >> M >> A >> B >> C >> T;
    if (N == 0) return false;

    Mat OP(N, vector(N, 0));
    for (int i = 0 ; i < N ; i++) {
        if (i > 0) OP[i][i - 1] = A;
        OP[i][i] = B;
        if (i + 1 < N) OP[i][i + 1] = C;
    }

    // out(OP);
    // cout << "----" << endl;
    OP = pow(OP, T, M);
    // out(OP);

    Mat V(N, vector(1, 0));
    for (int i = 0 ; i < N ; i++) cin >> V[i][0];
    Mat ans = mul(OP, V, M);
    for (int i = 0 ; i < N ; i++) cout << ans[i][0] << (i + 1 == N ? '\n' : ' ');

    return true;
}


int main() {
    while (solve()) ;
}
accuracy: 1
time_ms: 870
memory_kb: 3516
final_rank: 13

code_snippet: #include<bits/stdc++.h>
using namespace std;

int main(){
    int N, M, A, B, C, T;
    while(cin >> N >> M >> A >> B >> C >> T, N){
        vector<int> S(N);
        vector<vector<int>> D(N, vector<int>(N)), E(N, vector<int>(N));
        for(int i = 0; i < N; i++){
            cin >> S[i];
            E[i][i] = 1;
            if(i - 1 >= 0)D[i - 1][i] = C;
            D[i][i] = B;
            if(i + 1 < N)D[i + 1][i] = A;
        }
        auto mul = [&](vector<vector<int>> L, vector<vector<int>> R){
            vector<vector<int>> res(N, vector<int>(N));
            for(int i = 0; i < N; i++){
                for(int j = 0; j < N; j++){
                    for(int k = 0; k < N; k++){
                        (res[i][k] += L[i][j] * R[j][k]) %= M;
                    }
                }
            }
            return res;
        };
        while(T){
            if(T & 1)E = mul(E, D);
            D = mul(D, D);
            T /= 2;
        }
        for(int i = 0; i < N; i++){
            int v = 0;
            for(int j = 0; j < N; j++){
                (v += E[i][j] * S[j]) %= M;
            }
            if(i)cout << " ";
            cout << v;
        }
        cout << '\n';
    }
}
accuracy: 1
time_ms: 280
memory_kb: 3564
final_rank: 5

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (int i = (int)(s); i < (int)(t); ++i)
#define revrep(i, t, s) for (int i = (int)(t)-1; i >= (int)(s); --i)
#define all(x) begin(x), end(x)
template <typename T> bool chmax(T& a, const T& b) { return a < b ? (a = b, 1) : 0; }
template <typename T> bool chmin(T& a, const T& b) { return a > b ? (a = b, 1) : 0; }

vector<vector<int>> matmul(vector<vector<int>> A, vector<vector<int>> B, int M) {
    const int n = A.size();
    const int m = B[0].size();
    vector<vector<int>> C(n, vector<int>(m));
    rep(i,0,n) rep(j,0,m) rep(k,0,B.size()) C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % M;
    return C;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);

    while (true) {
        int N, M, A, B, C, T;
        cin >> N >> M >> A >> B >> C >> T;
        if (N == 0) break;
        vector<int> S(N);
        for (auto& x : S) cin >> x;

        vector<vector<int>> X(N, vector<int>(N));
        rep(i,0,N) {
            if (i > 0) X[i][i-1] = C;
            X[i][i] = B;
            if (i+1 < N) X[i][i+1] = A;
        }
        vector<vector<int>> ans(1, vector<int>(N));
        rep(i,0,N) ans[0][i] = S[i];
        while (T) {
            if (T & 1) {
                ans = matmul(ans, X, M);
            }
            X = matmul(X, X, M);
            T >>= 1;
        }
        rep(i,0,N) cout << ans[0][i] << (i < N-1 ? " " : "\n");
    }
}
accuracy: 1
time_ms: 540
memory_kb: 3384
final_rank: 7

code_snippet: #include <bits/stdc++.h>
//#include <atcoder/all>
//using namespace atcoder;
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
#define all(A) A.begin(),A.end()
#define rep(i, n) for (ll i = 0; i < (ll) (n); i++)
using pqr = priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>;

bool chmax(ll& p, ll q) {
    if (p < q) {
        p = q;
        return 1;
    }
    else {
        return 0;
    }
}

bool chmin(ll& p, ll q) {
    if (p > q) {
        p = q;
        return 1;
    }
    else {
        return 0;
    }
}

ll sti(string S) {
    ll res = 0;
    rep(i, S.size()) {
        res += S[i] - '0';
        res *= 10;
    }
    return res / 10;
}

string ist(ll n, ll L = -1) {
    string res = "";
    if (L >= 0)rep(l, L)res += '0';
    ll p = L - 1;
    if (L != -1)while (n > 0) {
        res[p] = char(n % 10 + '0');
        p--;
        n /= 10;
    }
    else {
        while (n > 0) {
            res.push_back(char(n % 10 + '0'));
            p--;
            n /= 10;
        }
        reverse(all(res));
    }
    return res;
}

ll gcd(ll(a), ll(b)) {
    ll c = a;
    while (a % b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return b;
}

ll mod = 998244353;

vector<vector<vector<ll>>> matrixpow;
void prematrixpow(vector<vll> matrix) {
	ll N = matrix.size();
	matrixpow.assign(70, vector<vll>(N, vll(N)));
	rep(h, N) {
		rep(w, N) {
			matrixpow[0][h][w] = matrix[h][w];
		}
	}
	rep(k, 69) {
		rep(h, N) {
			rep(w, N) {
				ll S = 0;
				rep(i, N) {
					S += matrixpow[k][h][i] * matrixpow[k][i][w];
					S %= mod;
				}
				matrixpow[k + 1][h][w] = S;
			}
		}
	}

}
vector<vll> modmatrixpow(ll K) {
	ll P = K;
	ll N = matrixpow[0].size();
	vector<vll> res(N, vll(N, 0));
	rep(i, N) {
		res[i][i] = 1;
	}

	rep(j, 70) {
		if (P % 2 != 0) {
			vector<vll> res2(N, vll(N, 0));

			rep(h, N) {
				rep(w, N) {
					ll S = 0;
					rep(i, N) {
						S += matrixpow[j][h][i] * res[i][w];
						S %= mod;
					}
					res2[h][w] = S;
				}
			}
			res = res2;
		}
		P /= 2;
	}

	return res;


}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    while(1){
        ll N,M,A,B,C,T;
        cin>>N>>M>>A>>B>>C>>T;
        if(N==0)return 0;
        vll D(N);
        rep(i,N)cin>>D[i];
        mod=M;
        vvll F(N,vll(N));
        rep(i,N){
            F[i][i]=B;
            if(i!=0){
                F[i-1][i]=C;  
                F[i][i-1]=A;
            }  
        }
        prematrixpow(F);
        auto k=modmatrixpow(T);
        vll AN(N,0);
        rep(i,N){
            rep(j,N){
                AN[i]+=k[i][j]*D[j];
                AN[i]%=M;
            }
            cout<<AN[i]<<(i==N-1?"\n":" ");
        }


    }

}
accuracy: 1
time_ms: 2540
memory_kb: 4780
final_rank: 20