#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("game.in","r",stdin)
#define OUT freopen("game.out","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define LOG 19
#define off 2
#define sq(x) ((x)*(x))
using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less< i64 >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

//#define mod 998244353LL
#define INF 1000000000
#define maxn 5000005
#define LL long long

int mod ;

void FWHT(vector<LL> &p, bool inv) {
  int n = p.size(); assert((n&(n-1))==0);
  for (int len=1; 2*len<=n; len <<= 1) {
    for (int i = 0; i < n; i += len+len){
      for (int j = 0; j < len; j++) {
        LL u = p[i+j], v = p[i+len+j];
        p[i+j]=(u+v); p[i+len+j]=(u-v);
      }
    }
  }
  if(inv) for(int i=0;i<n;i++) p[i]/=n;
}

vector<LL> convo(vector<LL> a, vector<LL> b) {
  int n = 1, sz = max(a.size(), b.size());
  while(n<sz) n*=2;
  a.resize(n); b.resize(n); vector<LL>res(n, 0);
  FWHT(a, 0); FWHT(b, 0);
  for(int i=0;i<n;i++)  res[i] = (a[i] * b[i])%mod;
  FWHT(res, 1);
  return res;
}

vector <i64> init ;
vector <i64> c ;

vector<i64> f(i64 t, int m)
{
    if(t==0)
    {
        vector <i64> res((1<<m),0) ;
        res[0] = 1 ;
        return res ;
    }
    vector <i64> r = f(t/2,m) ;
    r = convo(r,r) ;
    for(int i=0 ; i<(1<<m) ; i++ ) r[i] = r[i]%mod ;
    if(t%2)
    {
        r = convo(r,c) ;
        for(int i=0 ; i<(1<<m) ; i++ ) r[i] = r[i]%mod ;
    }
    return r ;
}

int main()
{
    int m ;
    i64 t ;
    scanf("%d %lld %d",&m,&t,&mod) ;

    for(int i=0 ; i<(1<<m) ; i++)
    {
        i64 v ;
        scanf("%lld",&v) ;
        init.pb(v) ;
    }

    c.resize( (1<<m) , 0 ) ;

    for(int i=0 ; i<=m ; i++)
    {
        i64 v ;
        scanf("%lld",&v) ;
        for(int j=0 ; j<(1<<m) ; j++)
        {
            if( __builtin_popcount(j) == i ) c[j] = v ;
        }
    }

//    DBG ;

    vector <i64> b = f(t,m) ;

    vector <i64> ans = convo(b,init) ;

    for(int i=0 ; i<(1<<m) ; i++) ans[i] = ans[i]%mod ;

    for(int i=0 ; i<(1<<m) ; i++) printf("%lld\n",ans[i]) ;

    return 0 ;
}
