You are given two arrays of positive integers ‘ARR1’ and ‘ARR2’ of length ‘N’ and ‘M’ respectively, where ‘N’ >= ‘M’.
Dot product of 2 arrays ‘ARR1’ and ‘ARR2’ of size ‘N’ is defined as ‘ARR1[i]*ARR2[i]’ for ‘1 <= i <= N’.
You are allowed to insert a certain number of 0s in ‘ARR2’ to make its size equal to ‘N’, but you cannot change the initial ordering of its elements. What is the maximum dot product of ‘ARR1’ and ‘ARR2’ you can achieve by doing this operation optimally?
Input Format :
The first line contains an integer ‘T’, which denotes the number of test cases to be run. Then, the ‘T’ test cases follow.
The first line of each test case contains two positive integers, ‘N’ and ‘M’ denoting the size of the array ‘ARR1’ and ‘ARR2’ respectively.
The second line of each test case contains ‘N’ space-separated positive integers denoting the elements of ‘ARR1’.
The third line of each test case contains ‘M’ space-separated positive integers denoting the elements of ‘ARR2’.
Output Format :
For each test case, print a single positive integer, the maximum value of the dot product between ‘ARR1’ and ‘ARR2’.
The output of each test case will be printed in a separate line.
Note :
You do not need to print anything. It has already been taken care of. Just implement the given function.
Constraints :
1 <= ‘T’ <= 10
1 <= ‘N’, ‘M’ <= 1000
1 <= ‘ARR1[i]’, ‘ARR2[i]’ <= 1000
Where ‘T’ is the number of test cases, ‘N’, ‘M’ is the size of the arrays, and ARR1[i], ARR2[i] is the ith element of each of the arrays respectively.
Time Limit: 1 sec