#include using namespace std; int mod = 1000000007; long long dp[45][45][20005]; long long fac[200005], finv[200005], inv[200005]; void COMinit(int m) { fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1; for (int i = 2; i < 200005; i++){ fac[i] = fac[i - 1] * i % m; inv[i] = m - inv[m % i] * (m / i) % m; finv[i] = finv[i - 1] * inv[i] % m; } } long long COM(int n, int k,int m){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % m) % m; } int main() { int N,Mp,Mq,L; cin >> N >> Mp >> Mq >> L; vectorS(N); for(int i = 0; i < N; i++) { cin >> S[i]; } dp[0][0][0] = 1; for(int i = 0; i < N; i++) { for(int j = 0; j <= N; j++) { long long sum = 0; for(int k = 0; k <= Mq; k++) { dp[i+1][j][k] += dp[i][j][k]; if(dp[i+1][j][k] > mod) { dp[i+1][j][k] -= mod; } if(k > S[i]) { sum += mod-dp[i][j][k-S[i]-1]; if(sum > mod) { sum -= mod; } } dp[i+1][j+1][k] += sum; if(dp[i+1][j+1][k] > mod) { dp[i+1][j+1][k] -= mod; } sum += dp[i][j][k]; if(sum > mod) { sum -= mod; } } } } long long ans = 0; COMinit(mod); for(int i = 0; i <= N; i++) { for(int j = 0; j <= Mq; j++) { int p = Mp-(L*i-j); ans += dp[N][i][j]*COM(p+N-1,N-1,mod)%mod; if(ans > mod) { ans -= mod; } } } cout << ans << endl; }