


'N' = 3, 'A' = {3, 1, 2, 3}, 'X' = 4, 'Y'= 2, 'SUM' = 14
For 'i' = 1, 'j' = 2, Value of the expression = 4 * 3 + 2 * 1 = 14.
For 'i' = 1, 'j' = 3, Value of the expression = 4 * 3 + 2 * 2 = 16.
For 'i' = 1, 'j' = 4, Value of the expression = 4 * 3 + 2 * 3 = 18.
For 'i' = 2, 'j' = 3, Value of the expression = 4 * 1 + 2 * 2 = 8.
For 'i' = 2, 'j' = 4, Value of the expression = 4 * 1 + 2 * 3 = 10.
For 'i' = 3, 'j' = 4, Value of the expression = 4 * 2 + 2 * 3 = 14.
The possible pairs are :
(1, 3), (3,4)
The first line contains an integer 'T', which denotes the number of test cases to be run. Then the test cases follow.
The first line of each test case contains four integers 'N', 'X', 'Y', 'SUM' denoting the size of the array, coefficient of the first element, coefficient of the second element, and the sum to be searched for.
The next line contains 'N' space-separated integers representing the elements of the array.
For each test case, print an integer, which denotes the number of pairs ('i', 'j') such that ('A[i]*X' + 'A[j]*Y') = 'SUM'.
Print the output of each test case in a new line.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 10^5
1 <= X, Y <= 10^4
1 <= SUM <= 10^9
0 <= A[i] <= 10^5
It is guaranteed that the count of pairs will fit in a 32-bit integer.
The Sum of 'N' over all test cases is <= 10^5.
Time Limit: 1 sec