#include using namespace std; typedef long long int ll; ll mod = 1000000007; ll r(ll x, ll y) { if (y == 0) return 1; else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod; else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod; } ll n, m, sumR, sumV; ll R[100], V[100]; ll dpr[101][100005] = {}; ll dpv[101][100005] = {}; void dpR() { for (int i = 0; i < m; i++) { for (int j = 0; j <= sumR; j++) { if (i == 0) { if (j == 0) dpr[i][j] = 1; else if (j == R[i]) dpr[i][j] = 1; else dpr[i][j] = 0; } else if (j < R[i]) dpr[i][j] = dpr[i-1][j]; else dpr[i][j] = dpr[i-1][j] + dpr[i-1][j-R[i]]; } } } void dpV() { for (int i = 0; i < n; i++) { for (int j = 0; j <= sumV; j++) { if (i == 0) { if (j == 0) dpv[i][j] = 1; else if (j == V[i]) dpv[i][j] = 1; else dpv[i][j] = 0; } else if (j < V[i]) dpv[i][j] = dpv[i-1][j]; else dpv[i][j] = dpv[i-1][j] + dpv[i-1][j-V[i]]; } } } int main() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> V[i]; sumV += V[i]; } for (int i = 0; i < m; i++) { cin >> R[i]; sumR += R[i]; } dpR(); dpV(); vector sv(sumV+1); sv[0] = 0; vector sr(sumR+1); sr[0] = 0; for (int i = 1; i < sumV + 1; i++) sv[i] = sv[i-1] + dpv[n-1][i]; for (int i = 1; i < sumR + 1; i++) sr[i] = sr[i-1] + dpr[m-1][i]; int a, b; cin >> a >> b; ll count = 0; for (int i = 1; i < sumR + 1; i++) { if (dpr[m-1][i] > 0) { ll A = a * i; ll B = b * i; A--; if (A < sumV) { count += (dpr[m-1][i] * (sv[min(sumV, B)] - sv[A])); count %= mod; } } } cout << count <