#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "limits.h" #define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++) #define all(i) i.begin(), i.end() #define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) void debug_out(){std::cerr< void debug_out(Head h,Tail... t){ std::cerr<<" "< std::ostream& operator<<(std::ostream& os, std::pair pa) { return os << pa.first << " " << pa.second; } template std::ostream& operator<<(std::ostream& os, std::vector vec) { for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " "); return os; } template inline bool chmax(T1& a,T2 b){return a inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);} long long pow_mod(long long a, long long b, long long mod=-1) { if(b==0)return 1; if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) { return 0; } long long x = 1; while (b > 0) { if (b & 1) { x = (mod!=-1)?(x * a) % mod:x*a; } a = (mod!=-1)?(a * a) % mod:a*a; b >>= 1; } return x; } // const long long MOD = 998244353; const long long MOD = 1e9 + 7; using ll = long long; using P=std::pair; using mat=std::vector>; mat Mul(mat a,mat b,ll mod){ assert(a[0].size()==b.size()); mat ret(a.size(),std::vector(b[0].size())); for(ll i=0;i(n,0)); rep(i,0,n)x[i][i]=1; while (b > 0) { if (b & 1) { x = Mul(x,a,mod); } a =Mul(a,a,mod); b >>= 1; } return x; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); ll n,w,k; std::cin>>n>>w>>k; std::vector a(n); rep(i,0,n)std::cin>>a[i]; std::vector dp1(2*w+1,0); dp1[0]=1; rep(i,0,2*w){ for(auto e:a){ if(i+e>2*w)continue; dp1[i+e]+=dp1[i]; dp1[i+e]%=MOD; } } ll one=dp1[w],two=(dp1[2*w]-one*one%MOD+MOD)%MOD; ll a1=one,a0=1; mat ma=std::vector>(2,std::vector(2)); ma[0][0]=one; ma[0][1]=two; ma[1][0]=1; ma[1][1]=0; ma=pow_mod(ma,k-1,MOD); std::cout<<(ma[0][0]*a1%MOD+ma[0][1]*a0%MOD)%MOD<<"\n"; return 0; }