#define _USE_MATH_DEFINES #include using namespace std; //template #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(a);i>(b);i--) #define ALL(v) (v).begin(),(v).end() typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12; void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;} template inline bool chmax(T& a,T b){ if(a inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; } //template end templatestruct mint { unsigned val; static unsigned get_mod(){return mod;} unsigned inv() const{ int tmp,a=val,b=mod,x=1,y=0; while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y); if(x<0)x+=mod; return x; } mint():val(0){} mint(ll x):val(x>=0?x%mod:mod+(x%mod)){} mint pow(ll t){mint res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;} mint& operator+=(const mint& x){if((val+=x.val)>=mod)val-=mod;return *this;} mint& operator-=(const mint& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;} mint& operator*=(const mint& x){val=ll(val)*x.val%mod; return *this;} mint& operator/=(const mint& x){val=ll(val)*x.inv()%mod; return *this;} mint operator+(const mint& x)const{return mint(*this)+=x;} mint operator-(const mint& x)const{return mint(*this)-=x;} mint operator*(const mint& x)const{return mint(*this)*=x;} mint operator/(const mint& x)const{return mint(*this)/=x;} bool operator==(const mint& x)const{return val==x.val;} bool operator!=(const mint& x)const{return val!=x.val;} }; templatestruct factorial { using Mint=mint; vector Fact, Finv; public: factorial(int maxx){ Fact.resize(maxx+1),Finv.resize(maxx+1); Fact[0]=Mint(1); rep(i,0,maxx)Fact[i+1]=Fact[i]*(i+1); Finv[maxx]=Mint(1)/Fact[maxx]; rrep(i,maxx,0)Finv[i-1]=Finv[i]*i; } Mint fact(int n,bool inv=0){if(inv)return Finv[n];else return Fact[n];} Mint nPr(int n,int r){if(n<0||nstruct mat{ int h,w; vector> val; mat(){} mat(int n,int m):h(n),w(m),val(vector>(n,vector(m,0))){} vector& operator[](const int i){return val[i];} mat& operator+=(const mat& m){ rep(i,0,h)rep(j,0,w)val[i][j]+=m.val[i][j]; return *this; } mat& operator-=(const mat& m){ rep(i,0,h)rep(j,0,w)val[i][j]-=m.val[i][j]; return *this; } mat& operator*=(const mat& m){ mat res(h,m.w); rep(i,0,h)rep(j,0,m.w)rep(k,0,w)res.val[i][j]+=val[i][k]*m.val[k][j]; *this=res; return *this; } mat operator+(const mat& m)const{return mat(*this)+=m;} mat operator-(const mat& m)const{return mat(*this)-=m;} mat operator*(const mat& m)const{return mat(*this)*=m;} mat pow(ll k){ mat res(h,h),c=*this; rep(i,0,h)res.val[i][i]=1; while(k){if(k&1)res*=c; c*=c; k>>=1;} return res; } T det(){ assert(h==w); T res=1; rep(i,0,w){ int idx=-1; rep(j,i,w)if(val[j][i]!=0)idx=j; if(idx==-1)return 0; if(i!=idx)res*=-1; swap(val[i],val[idx]); res*=val[i][i]; T buf=val[i][i]; rep(j,0,w)val[i][j]/=buf; rep(j,i+1,w){ T mul=val[j][i]; rep(k,0,w)val[j][k]-=val[i][k]*mul; } } return res; } vector gauss(int c=-1){ if(val.empty())return {}; if(c==-1)c=val[0].size(); int h=val.size(),w=val[0].size(),r=0; vector res; rep(i,0,c){ if(r==h)break; rep(j,r,h)if(val[j][i]!=0){swap(val[r],val[j]); break;} if(val[r][i]==0)continue; rep(j,0,h)if(j!=r){ T buf=val[j][i]/val[r][i]; rep(k,i,w)val[j][k]-=val[r][k]*buf; } res.push_back(i); r++; } return res; } }; using Mint=mint<>; int main(){ int n,m; ll k; scanf("%d%d%lld",&n,&m,&k); vector a(n); rep(i,0,n)scanf("%d",&a[i]); vector dp(2*m+1); dp[0]=1; rep(i,0,2*m+1)if(i!=m){ rep(j,0,n)if(i+a[j]<=2*m)dp[i+a[j]]+=dp[i]; } mat ma(2,2); ma[0][0]=dp[m]; ma[0][1]=dp[2*m]; ma[1][0]=1; ma[1][1]=0; ma=ma.pow(k); printf("%d\n",ma[0][0].val); return 0; }