408415: GYM103115 I chino with mates

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. chino with matestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Chino held a blind date event, there are n male guests and m female guests attending.

The personality characteristic value of each person can be represented by an integer, the personality characteristic value of the i-th male guest is $$$a_i$$$, and the personality characteristic value of the j-th female guest is $$$b_j$$$.

Chino believes that when the calculation result of the personality characteristic values of two people $$$a_i \times b_j$$$ in a certain range [l,r], the personality of two person is suitable each of them.

Chino would like to know how many matching combinations possible satisfied personality suitability between male and female guests.

Input

The first line contain two positive integers $$$n,m(1 \leq n,m \leq 10^5)$$$

The next line contain n integers $$$a_i(-10^9 \leq a_i \leq 10^9)$$$ indicates the personality characteristic value of the male guests.

Then the next line contain m integers$$$b_i(-10^9 \leq b_i \leq 10^9)$$$ indicates the personality characteristic value of the female guests.

the final line only contain two integers $$$l,r(-10^9 \leq l \leq r \leq 10^9)$$$

Output

Output an integer on a line to indicate the number of matching combinations.

ExamplesInput
5 5
1 2 3 4 5
1 2 3 4 5
1 20
Output
24
Input
3 4
-1 -3 -5
-7 -6 -8 -9
9 9
Output
1
Note

For the first example, except that the male guest 5 and the female guest 5 do not meet the conditions, the other conditions are all legal, so the answer is 25-1=24

For the second example, there is only a legal matching combination for male guest 1 and female guest 4.

加入题单

上一题 下一题 算法标签: