/* -*- coding: utf-8 -*- * * 997.cc: No.997 Jumping Kangaroo - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_W = 40; const int MAX_W2 = MAX_W * 2; const int MOD = 1000000007; /* typedef */ typedef long long ll; typedef int mat[2][2]; /* global variables */ int as[MAX_W2]; int dp[MAX_W2 + 1]; mat ma, mb; /* subroutines */ inline void addmod(int &a, int b) { a = (a + b) % MOD; } int do_dp(int n, int w) { memset(dp, 0, sizeof(dp)); dp[0] = 1; for (int i = 0; i < w; i++) if (dp[i] > 0) for (int j = 0; j < n && i + as[j] <= w; j++) addmod(dp[i + as[j]], dp[i]); return dp[w]; } inline void initmat(mat a) { memset(a, 0, sizeof(mat)); } inline void unitmat(mat a) { initmat(a); a[0][0] = a[1][1] = 1; } inline void copymat(const mat a, mat b) { memcpy(b, a, sizeof(mat)); } inline void mulmat(const mat a, const mat b, mat c) { c[0][0] = ((ll)a[0][0] * b[0][0] % MOD + (ll)a[0][1] * b[1][0] % MOD) % MOD; c[0][1] = ((ll)a[0][0] * b[0][1] % MOD + (ll)a[0][1] * b[1][1] % MOD) % MOD; c[1][0] = ((ll)a[1][0] * b[0][0] % MOD + (ll)a[1][1] * b[1][0] % MOD) % MOD; c[1][1] = ((ll)a[1][0] * b[0][1] % MOD + (ll)a[1][1] * b[1][1] % MOD) % MOD; } inline void powmat(const mat a, ll b, mat c) { mat s, t; copymat(a, s); unitmat(c); while (b > 0) { if (b & 1) { mulmat(c, s, t); copymat(t, c); } mulmat(s, s, t); copymat(t, s); b >>= 1; } } /* main */ int main() { int n, w; ll k; scanf("%d%d%lld", &n, &w, &k); int w2 = w * 2; for (int i = 0; i < n; i++) scanf("%d", as + i); sort(as, as + n); int d1 = do_dp(n, w); int d2 = (do_dp(n, w2) + (MOD - (ll)d1 * d1 % MOD)) % MOD; //printf("%d %d\n", d1, d2); // f_n = d1 * f_{n-1} + d2 * f_{n-2} ma[0][0] = 0; ma[0][1] = 1; ma[1][0] = d2; ma[1][1] = d1; powmat(ma, k, mb); int r = (mb[0][0] + (ll)mb[0][1] * d1 % MOD) % MOD; printf("%d\n", r); return 0; }