Limits 1s, 512 MB

Thanos just finished his relief work.

We all know that Thanos loves balanced things. So he finds something to be balanced in his relief work. He wants to know how many Balanced Relief Pair are possible in the relief work.

The Balanced Relief Pair is a pair where one is male and another one is female, And the summation of their relief unit is in the range L to R inclusive.

For example: suppose there are 3 males and 2 females. Relief units of males and females are {1,2,3}\{1, 2, 3\} and {4,5}\{4, 5\} respectively, And the range is {7,9}\{7, 9\}. For this example the Balanced Relief Pairs are {3,4}\{3, 4\}, {2,5}\{2, 5\} and {3,5}\{3, 5\}, so the answer for this example is 3.

Input

Input starts with two integers NN and MM (1N,M1061 ≤ N, M ≤ 10^6) denoting the numbers of males and females people. The second line contains NN integers AiA_i (1Ai1081 ≤ A_i ≤ 10^8) of them is the relief units for ii-th male people. The third line contains MM integers BiB_i (1Bi1081 ≤ B_i ≤ 10^8) of them is the relief units for ii-th female people. The fourth line contains two integers LL and RR (0LR1090 ≤ L ≤ R ≤ 10^9) denoting the range.

Output

Print a single integer denoting the number of balanced relief pair.

Sample

InputOutput
3 3
6 1 6 
5 3 2 
8 16
6

Submit

Login to submit.

Statistics

60% Solution Ratio
Gias_UddinEarliest, Aug '19
steinumFastest, 0.0s
steinumLightest, 9.3 kB
jaberndcShortest, 371B
Toph uses cookies. By continuing you agree to our Cookie Policy.