#include using namespace std; #define MOD 1000000007 int N, MP, Mq, L; vector S; long solve(int i, int rP, int rq){ if (i == N){ if (rP == 0) return 1; return 0; } long ans = 0; for (int mP = 0; mP <= rP; mP++){ ans = (ans + solve(i + 1, rP - mP, rq)) % MOD; } for (int mq = 1; mq <= min(rq, S[i]); mq++){ if (mq + rP < L) continue; int needP = L - mq; if (needP < 0) continue; for (int mP = needP; mP <= rP; mP++){ ans = (ans + solve(i + 1, rP - mP, rq - mq)) % MOD; } } return ans; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); cin >> N >> MP >> Mq >> L; S.resize(N); for (int i = 0; i < N; i++){ cin >> S[i]; } cout << solve(0, MP, Mq) << endl; }