Problem: You have given an array of length and an integer to a brand new robot. What the robot does is the following: it iterates over the elements of the array, let the current element be . If is divisible by , the robot adds copies of the integer to the end of the array, and moves on to the next element. Note that the newly added elements could be processed by the robot later. Otherwise, if is not divisible by , the robot shuts down.
Please determine the sum of all values of the array at the end of the process.
Input Format: The first input line contains a single integer () — the number of test cases.
The first line of each test case contains two integers and (, ) — the length of the array and the value which is used by the robot.
The next line contains integers , , ..., () — the initial values in the array.
It is guaranteed that the sum of values over all test cases does not exceed .
Output Format: For each test case output one integer — the sum of all elements at the end of the process.
Note: In the first test case the array initially consists of a single element , and . After the robot processes the first element, the array becomes . Then the robot processes the second element, and the array becomes . After the robot processes the next element, the array becomes , and then the robot shuts down, since it encounters an element that is not divisible by . The sum of the elements in the resulting array is equal to .
In the second test case the array initially contains integers , and . The resulting array in this case looks like .