import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int mod = 1000000007; int n = sc.nextInt(); int m = sc.nextInt(); int[] vArr = new int[n]; int[] rArr = new int[m]; for(int i = 0; i < n; i++) vArr[i] = sc.nextInt(); for(int i = 0; i < m; i++) rArr[i] = sc.nextInt(); long a = sc.nextInt(); long b = sc.nextInt(); long[] dpV = new long[101010]; dpV[0] = 1L; long[] dpR = new long[101010]; dpR[0] = 1L; for(int i = 0; i < n; i++) for(int j = dpV.length - 1; j > 0; j--) { if(j - vArr[i] < 0) continue; dpV[j] = (dpV[j] + dpV[j - vArr[i]]) % mod; } for(int i = 0; i < m; i++) for(int j = dpR.length - 1; j > 0; j--) { if(j - rArr[i] < 0) continue; dpR[j] = (dpR[j] + dpR[j - rArr[i]]) % mod; } for(int i = 1; i < dpV.length; i++) dpV[i] = (dpV[i] + dpV[i-1]) % mod; long cnt = 0L; for(int r = 1; r < dpR.length; r++) { if(dpR[r] == 0) continue; long leftV = a * r; long rightV = b * r; if(leftV > dpV.length - 1) continue; rightV = Math.min(rightV, dpV.length - 1); cnt = cnt + (long)dpR[r] * (dpV[(int)rightV] - dpV[(int)leftV - 1]) % mod; } System.out.println(cnt % mod); } }