There are 2 criteria to make a difficult password:
1) Choose M numbers out of N given numbers:
= summation of differences between every 2 adjacent M numbers.
For example: if the M numbers are: :
.
2) For given :
= numbers in the interval (both inclusive) that don't have divisors in the M numbers.
Write a program to choose M numbers out of N numbers to maximise the summation
of ().
Input Format
First line contain T, that denotes number of test cases.
For each test case:
Second line contains 2 integers .
Third line contains 2 integers .
Fourth line contains N numbers.
Output Format
For each test case print the maximum value of that could be achieved.
Input Constraints
The Optimal solution is to choose , .
= difference between adjacent numbers + numbers that don't have divisors in the M numbers = 4 + 6 = .
Numbers that don't have divisors in the M numbers =